mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-01 01:09:22 +01:00
protocols: return an "oldchan" IrcChannel object with the previous state of a channel when processing channel mode changes
This allows plugins to check for op statuses, etc. before the mode change is processed.
This commit is contained in:
parent
a28715c2c6
commit
c82a0a771c
@ -466,11 +466,13 @@ class InspIRCdProtocol(TS6BaseProtocol):
|
||||
"""Handles the FMODE command, used for channel mode changes."""
|
||||
# <- :70MAAAAAA FMODE #chat 1433653462 +hhT 70MAAAAAA 70MAAAAAD
|
||||
channel = utils.toLower(self.irc, args[0])
|
||||
oldobj = self.irc.channels[channel].deepcopy()
|
||||
modes = args[2:]
|
||||
changedmodes = utils.parseModes(self.irc, channel, modes)
|
||||
utils.applyModes(self.irc, channel, changedmodes)
|
||||
ts = int(args[1])
|
||||
return {'target': channel, 'modes': changedmodes, 'ts': ts}
|
||||
return {'target': channel, 'modes': changedmodes, 'ts': ts,
|
||||
'oldchan': oldobj}
|
||||
|
||||
def handle_mode(self, numeric, command, args):
|
||||
"""Handles incoming user mode changes."""
|
||||
|
@ -603,11 +603,13 @@ class TS6Protocol(TS6BaseProtocol):
|
||||
"""Handles incoming TMODE commands (channel mode change)."""
|
||||
# <- :42XAAAAAB TMODE 1437450768 #endlessvoid -c+lkC 3 agte4
|
||||
channel = utils.toLower(self.irc, args[1])
|
||||
oldobj = self.irc.channels[channel].deepcopy()
|
||||
modes = args[2:]
|
||||
changedmodes = utils.parseModes(self.irc, channel, modes)
|
||||
utils.applyModes(self.irc, channel, changedmodes)
|
||||
ts = int(args[0])
|
||||
return {'target': channel, 'modes': changedmodes, 'ts': ts}
|
||||
return {'target': channel, 'modes': changedmodes, 'ts': ts,
|
||||
'oldchan': oldobj}
|
||||
|
||||
def handle_mode(self, numeric, command, args):
|
||||
"""Handles incoming user mode changes."""
|
||||
|
Loading…
Reference in New Issue
Block a user