mirror of
https://github.com/jlu5/PyLink.git
synced 2024-12-24 11:42:51 +01:00
protocols: add a chandata key to SJOIN hook payloads
This commit is contained in:
parent
3c7b201f57
commit
ae94bec6b8
@ -67,6 +67,7 @@ The following hooks represent regular IRC commands sent between servers.
|
||||
- `modes` returns a list of parsed modes: `(mode character, mode argument)` tuples, where the mode argument is either `None` (for modes without arguments), or a string.
|
||||
- The sender of this hook payload is IRCd-dependent, and is determined by whether the command was originally a SJOIN or regular JOIN - SJOIN is only sent by servers, and JOIN is only sent by users.
|
||||
- For IRCds that support joining multiple channels in one command (`/join #channel1,#channel2`), consecutive JOIN hook payloads of this format will be sent (one per channel).
|
||||
- For SJOIN, the `chandata` key may also be sent, with a copy of the `IrcChannel` object BEFORE any mode changes from this burst command were processed.
|
||||
|
||||
- **KICK**: `{'channel': '#channel', 'target': 'UID1', 'text': 'some reason'}`
|
||||
- `text` refers to the kick reason. The `target` and `channel` fields send the target's UID and the channel they were kicked from, and the sender of the hook payload is the kicker.
|
||||
@ -75,11 +76,11 @@ The following hooks represent regular IRC commands sent between servers.
|
||||
- `text` refers to the kill reason. `target` is the target's UID.
|
||||
- The `userdata` key may include an `IrcUser` instance, depending on the IRCd. On IRCds where QUITs are explicitly sent (InspIRCd), `userdata` will be `None`. Other IRCds do not explicitly send QUIT messages for KILLed clients, so the daemon must assume that they've quit, and deliver their last state to plugins that require this info.
|
||||
|
||||
- **MODE**: `{'target': '#channel', 'modes': [('+m', None), ('+i', None), ('+t', None), ('+l', '3'), ('-o', 'person')], 'oldchan': IrcChannel(...)}`
|
||||
- **MODE**: `{'target': '#channel', 'modes': [('+m', None), ('+i', None), ('+t', None), ('+l', '3'), ('-o', 'person')], 'chandata': IrcChannel(...)}`
|
||||
- `target` is the target the mode is being set on: it may be either a channel (for channel modes) OR a UID (for user modes).
|
||||
- `modes` is a list of prefixed parsed modes: `(mode character, mode argument)` tuples, but with `+/-` prefixes to denote whether each mode is being set or unset.
|
||||
- For channels, the `oldchan` key is also sent, with the state of the channel BEFORE this MODE hook was processed.
|
||||
- One such use for this is to prevent oper-override hacks: checks for whether a sender is opped have to be done before the MODE is processed; otherwise, someone can simply op themselves and circumvent this detection.
|
||||
- For channels, the `chandata` key is also sent, with a copy of the `IrcChannel` BEFORE this MODE hook was processed.
|
||||
- One use for this is to prevent oper-override hacks: checks for whether a sender is opped have to be done before the MODE is processed; otherwise, someone can simply op themselves and circumvent this detection.
|
||||
|
||||
- **NICK**: `{'newnick': 'Alakazam', 'oldnick': 'Abracadabra', 'ts': 1234567890}`
|
||||
|
||||
|
@ -521,6 +521,7 @@ class InspIRCdProtocol(TS6BaseProtocol):
|
||||
"""Handles incoming FJOIN commands (InspIRCd equivalent of JOIN/SJOIN)."""
|
||||
# :70M FJOIN #chat 1423790411 +AFPfjnt 6:5 7:5 9:5 :o,1SRAABIT4 v,1IOAAF53R <...>
|
||||
channel = self.irc.toLower(args[0])
|
||||
chandata = self.irc.channels[channel].deepcopy()
|
||||
# InspIRCd sends each channel's users in the form of 'modeprefix(es),UID'
|
||||
userlist = args[-1].split()
|
||||
|
||||
@ -554,7 +555,8 @@ class InspIRCdProtocol(TS6BaseProtocol):
|
||||
our_ts = self.irc.channels[channel].ts
|
||||
self.updateTS(servernumeric, channel, their_ts, changedmodes)
|
||||
|
||||
return {'channel': channel, 'users': namelist, 'modes': parsedmodes, 'ts': their_ts}
|
||||
return {'channel': channel, 'users': namelist, 'modes': parsedmodes, 'ts': their_ts,
|
||||
'chandata': chandata}
|
||||
|
||||
def handle_uid(self, numeric, command, args):
|
||||
"""Handles incoming UID commands (user introduction)."""
|
||||
|
@ -991,6 +991,8 @@ class P10Protocol(IRCS2SProtocol):
|
||||
return
|
||||
|
||||
channel = self.irc.toLower(args[0])
|
||||
chandata = self.irc.channels[channel].deepcopy()
|
||||
|
||||
userlist = args[-1].split()
|
||||
|
||||
bans = []
|
||||
@ -1069,7 +1071,8 @@ class P10Protocol(IRCS2SProtocol):
|
||||
our_ts = self.irc.channels[channel].ts
|
||||
self.updateTS(source, channel, their_ts, changedmodes)
|
||||
|
||||
return {'channel': channel, 'users': namelist, 'modes': parsedmodes, 'ts': their_ts}
|
||||
return {'channel': channel, 'users': namelist, 'modes': parsedmodes, 'ts': their_ts,
|
||||
'chandata': chandata}
|
||||
|
||||
def handle_join(self, source, command, args):
|
||||
"""Handles incoming JOINs and channel creations."""
|
||||
|
@ -422,6 +422,7 @@ class TS6Protocol(TS6BaseProtocol):
|
||||
# parameters: channelTS, channel, simple modes, opt. mode parameters..., nicklist
|
||||
# <- :0UY SJOIN 1451041566 #channel +nt :@0UYAAAAAB
|
||||
channel = self.irc.toLower(args[1])
|
||||
chandata = self.irc.channels[channel].deepcopy()
|
||||
userlist = args[-1].split()
|
||||
|
||||
modestring = args[2:-1] or args[2]
|
||||
@ -465,7 +466,8 @@ class TS6Protocol(TS6BaseProtocol):
|
||||
our_ts = self.irc.channels[channel].ts
|
||||
self.updateTS(servernumeric, channel, their_ts, changedmodes)
|
||||
|
||||
return {'channel': channel, 'users': namelist, 'modes': parsedmodes, 'ts': their_ts}
|
||||
return {'channel': channel, 'users': namelist, 'modes': parsedmodes, 'ts': their_ts,
|
||||
'chandata': chandata}
|
||||
|
||||
def handle_join(self, numeric, command, args):
|
||||
"""Handles incoming channel JOINs."""
|
||||
|
@ -544,6 +544,7 @@ class UnrealProtocol(TS6BaseProtocol):
|
||||
# in ":001AAAAAA @001AAAAAB +001AAAAAC".
|
||||
# Interestingly, no modes are ever sent in this command as far as I've seen.
|
||||
channel = self.irc.toLower(args[1])
|
||||
chandata = self.irc.channels[channel].deepcopy()
|
||||
userlist = args[-1].split()
|
||||
|
||||
namelist = []
|
||||
@ -583,7 +584,8 @@ class UnrealProtocol(TS6BaseProtocol):
|
||||
their_ts = int(args[0])
|
||||
self.updateTS(numeric, channel, their_ts, changedmodes)
|
||||
|
||||
return {'channel': channel, 'users': namelist, 'modes': self.irc.channels[channel].modes, 'ts': their_ts}
|
||||
return {'channel': channel, 'users': namelist, 'modes': self.irc.channels[channel].modes,
|
||||
'ts': their_ts, 'chandata': chandata}
|
||||
|
||||
def handle_nick(self, numeric, command, args):
|
||||
"""Handles NICK changes, and legacy NICK introductions from pre-4.0 servers."""
|
||||
|
Loading…
Reference in New Issue
Block a user