Bug fix: Handle multiple mode changes in the same command

This commit is contained in:
Kiooeht 2011-05-24 22:51:51 -07:00
parent aab2654300
commit 317e42a29e

15
irc.py
View file

@ -341,7 +341,8 @@ class PesterHandler(DefaultCommandHandler):
self.parent.userPresentUpdate.emit(handle, channel, "join") self.parent.userPresentUpdate.emit(handle, channel, "join")
if channel == "#pesterchum": if channel == "#pesterchum":
self.parent.moodUpdated.emit(handle, Mood("chummy")) self.parent.moodUpdated.emit(handle, Mood("chummy"))
def mode(self, op, channel, mode, handle=""): def mode(self, op, channel, mode, *handles):
if len(handles) <= 0: handles = [""]
opnick = op[0:op.find("!")] opnick = op[0:op.find("!")]
if op == channel or channel == self.parent.mainwindow.profile().handle: if op == channel or channel == self.parent.mainwindow.profile().handle:
modes = list(self.parent.mainwindow.modes) modes = list(self.parent.mainwindow.modes)
@ -356,7 +357,17 @@ class PesterHandler(DefaultCommandHandler):
pass pass
modes.sort() modes.sort()
self.parent.mainwindow.modes = "+" + "".join(modes) self.parent.mainwindow.modes = "+" + "".join(modes)
self.parent.userPresentUpdate.emit(handle, channel, mode+":%s" % (op)) modes = []
cur = "+"
for l in mode:
if l in ["+","-"]: cur = l
else:
modes.append("%s%s" % (cur, l))
for (i,m) in enumerate(modes):
try:
self.parent.userPresentUpdate.emit(handles[i], channel, m+":%s" % (op))
except IndexError:
self.parent.userPresentUpdate.emit("", channel, m+":%s" % (op))
def nick(self, oldnick, newnick): def nick(self, oldnick, newnick):
oldhandle = oldnick[0:oldnick.find("!")] oldhandle = oldnick[0:oldnick.find("!")]
if oldhandle == self.mainwindow.profile().handle: if oldhandle == self.mainwindow.profile().handle: