masshl.py fixes
This commit is contained in:
parent
cd9c301f67
commit
432ca3ea75
@ -43,7 +43,6 @@ class Loop():
|
||||
i += 1
|
||||
if self.N_param:
|
||||
N_nicks += " %s" % nick
|
||||
weechat.prnt("", "%s ; %s" % (nick, self.nicks[-1]))
|
||||
if (nick != self.nicks[-1] and
|
||||
len(output) + len(N_nicks) + len(self.nicks[i]) < 300):
|
||||
continue
|
||||
@ -52,9 +51,9 @@ class Loop():
|
||||
output = output.replace("%N",N_nicks)
|
||||
output = output.replace("%r","%08x" % random.randint(0,0xffffffff))
|
||||
if self.input_method == "keybinding":
|
||||
weechat.buffer_set(self.buffer, "input", output) #.encode("UTF-8"))
|
||||
weechat.buffer_set(self.buffer, "input", output)
|
||||
else:
|
||||
weechat.command(self.buffer, output) #.encode("UTF-8"))
|
||||
weechat.command(self.buffer, output)
|
||||
# sleep(self.delay)
|
||||
output = self.input
|
||||
N_nicks = ""
|
||||
@ -62,13 +61,6 @@ class Loop():
|
||||
def masshl_cmd_cb(data, buffer, args):
|
||||
input = args
|
||||
|
||||
# do we need to loop a bit before printing, or can we send after each nick?
|
||||
N_param = "%N" in input
|
||||
if not N_param and "%n" not in input and "%r" not in input:
|
||||
# if we bind this to Enter key, we don't want useless flooding on
|
||||
# normal messages
|
||||
return weechat.WEECHAT_RC_OK
|
||||
|
||||
input_method = "command"
|
||||
server = weechat.buffer_get_string(buffer, 'localvar_server')
|
||||
channel = weechat.buffer_get_string(buffer, 'localvar_channel')
|
||||
@ -77,6 +69,12 @@ def masshl_cmd_cb(data, buffer, args):
|
||||
input = (input + ' ' if input else '') + weechat.buffer_get_string(buffer, "input")
|
||||
input_method = "keybinding"
|
||||
|
||||
N_param = "%N" in input
|
||||
if not N_param and "%n" not in input and "%r" not in input:
|
||||
# if we bind this to Enter key, we don't want useless flooding on
|
||||
# normal messages
|
||||
return weechat.WEECHAT_RC_OK
|
||||
|
||||
optstop = input and input[0] == '-' and input.find(' ')
|
||||
opts = input[1:optstop] if optstop else ''
|
||||
cmdstop = 'd' in opts and input.find(' ', optstop+1)
|
||||
@ -100,6 +98,8 @@ def masshl_cmd_cb(data, buffer, args):
|
||||
while weechat.infolist_next(nicklist):
|
||||
nicks.append(weechat.infolist_string(nicklist, "name"))
|
||||
|
||||
weechat.infolist_free(nicklist)
|
||||
|
||||
workhorse = Loop(buffer, nicks, input, input_method, N_param, delay, opts)
|
||||
workhorse.run()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user