3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-27 21:19:31 +01:00

clientbot: add MODE handling

This commit is contained in:
James Lu 2016-07-21 19:12:05 -07:00
parent 3d7e8f8420
commit 04ed7a8f5d

View File

@ -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])