From 04ed7a8f5da4ebb08077a42445dc72c7d1f134bd Mon Sep 17 00:00:00 2001 From: James Lu Date: Thu, 21 Jul 2016 19:12:05 -0700 Subject: [PATCH] clientbot: add MODE handling --- protocols/clientbot.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/protocols/clientbot.py b/protocols/clientbot.py index 231f495..2e90cc8 100644 --- a/protocols/clientbot.py +++ b/protocols/clientbot.py @@ -339,7 +339,25 @@ class ClientbotWrapperProtocol(Protocol): self.part(target, channel, reason) return {'channel': channel, 'target': target, 'text': reason} + def handle_mode(self, source, command, args): + """Handles MODE changes.""" + # <- :GL!~gl@127.0.0.1 MODE #dev +v ice + # <- :ice MODE ice :+Zi + target = args[0] + if utils.isChannel(target): + target = self.irc.toLower(target) + oldobj = self.irc.channels[target].deepcopy() + else: + target = self.irc.nickToUid(target) + oldobj = None + modes = args[1:] + changedmodes = self.irc.parseModes(target, modes) + self.irc.applyModes(target, changedmodes) + + return {'target': target, 'modes': changedmodes, 'oldchan': oldobj} + def handle_nick(self, source, command, args): + """Handles NICK changes.""" # <- :GL|!~GL@127.0.0.1 NICK :GL_ oldnick = self.irc.users[source].nick self.nick(source, args[0])