received.mode -> received.mode.channel (and bugfixes!)

This commit is contained in:
jesopo 2018-09-02 22:40:41 +01:00
parent 72e991f4a5
commit 3f79154e2b

View file

@ -276,14 +276,15 @@ class LineHandler(object):
def mode(self, event):
nickname, username, hostname = Utils.seperate_hostmask(
event["prefix"])
user = event["server"].get_user(nickname)
target = event["args"][0]
is_channel = target[0] in event["server"].channel_types
if is_channel:
channel = event["server"].get_channel(target)
remove = False
args = event["args"][2:]
_args = args[:]
modes = RE_MODES.findall(event["args"][1])
for chunk in modes:
remove = chunk[0] == "-"
for mode in chunk[1:]:
@ -294,8 +295,9 @@ class LineHandler(object):
channel.change_mode(remove, mode, args.pop(0))
else:
args.pop(0)
self.events.on("received").on("mode").call(modes=modes,
mode_args=args, channel=channel, server=event["server"])
self.events.on("received").on("mode").on("channel").call(
modes=modes, mode_args=_args, channel=channel,
server=event["server"], user=user)
elif event["server"].is_own_nickname(target):
modes = RE_MODES.findall(event["arbitrary"] or args[1])
for chunk in modes: