From ee65ac60e165d072217f0fb7c15238721d5f0599 Mon Sep 17 00:00:00 2001 From: James Lu Date: Sat, 16 Jan 2016 16:53:46 -0800 Subject: [PATCH] protocols: rename sjoinServer(...) -> sjoin(...) --- docs/technical/pmodule-spec.md | 6 +++--- plugins/relay.py | 6 +++--- protocols/inspircd.py | 12 ++++++------ protocols/ts6.py | 12 ++++++------ protocols/unreal.py | 10 +++++----- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/docs/technical/pmodule-spec.md b/docs/technical/pmodule-spec.md index 107ed83..b7cdd2d 100644 --- a/docs/technical/pmodule-spec.md +++ b/docs/technical/pmodule-spec.md @@ -74,10 +74,10 @@ internals](https://github.com/GLolol/PyLink/blob/0.4.0-dev/classes.py#L267-L272) - **`quit`**`(self, source, reason)` - Quits a PyLink client. -- **`sjoinServer`**`(self, server, channel, users, ts=None)` - Sends an SJOIN for a group of users to a channel. The sender should always be a Server ID (SID). TS is +- **`sjoin`**`(self, server, channel, users, ts=None)` - Sends an SJOIN for a group of users to a channel. The sender should always be a Server ID (SID). TS is optional, and defaults to the one we've stored in the channel state if not given. `users` is a list of `(prefix mode, UID)` pairs. Example uses: - - `sjoinServer('100', '#test', [('', '100AAABBC'), ('qo', 100AAABBB'), ('h', '100AAADDD')])` - - `sjoinServer(self.irc.sid, '#test', [('o', self.irc.pseudoclient.uid)])` + - `sjoin('100', '#test', [('', '100AAABBC'), ('qo', 100AAABBB'), ('h', '100AAADDD')])` + - `sjoin(self.irc.sid, '#test', [('o', self.irc.pseudoclient.uid)])` - **`spawnServer`**`(self, name, sid=None, uplink=None, desc=None)` - Spawns a server off another PyLink server. `desc` (server description) defaults to the one in the config. `uplink` defaults to the main PyLink server, and `sid` (the server ID) is automatically generated if not given. Sanity checks for server name and SID validity ARE done by the protocol module here. diff --git a/plugins/relay.py b/plugins/relay.py index cd41eb0..ebbdf68 100644 --- a/plugins/relay.py +++ b/plugins/relay.py @@ -513,7 +513,7 @@ def relayJoins(irc, channel, users, ts, burst=True): # users/someone with a prefix. if burst or len(queued_users) > 1 or queued_users[0][0]: rsid = getRemoteSid(remoteirc, irc) - remoteirc.proto.sjoinServer(rsid, remotechan, queued_users, ts=ts) + remoteirc.proto.sjoin(rsid, remotechan, queued_users, ts=ts) relayModes(irc, remoteirc, getRemoteSid(irc, remoteirc), channel, irc.channels[channel].modes) else: remoteirc.proto.join(queued_users[0][1], remotechan) @@ -817,7 +817,7 @@ def handle_kick(irc, source, command, args): # kick ops, admins can't kick owners, etc. modes = getPrefixModes(remoteirc, irc, remotechan, real_target) # Join the kicked client back with its respective modes. - irc.proto.sjoinServer(irc.sid, channel, [(modes, target)]) + irc.proto.sjoin(irc.sid, channel, [(modes, target)]) if kicker in irc.users: log.info('(%s) Relay claim: Blocked KICK (reason %r) from %s to relay client %s on %s.', irc.name, args['text'], irc.users[source].nick, @@ -965,7 +965,7 @@ def handle_kill(irc, numeric, command, args): modes = getPrefixModes(remoteirc, irc, remotechan, realuser[1]) log.debug('(%s) relay handle_kill: userpair: %s, %s', irc.name, modes, realuser) client = getRemoteUser(remoteirc, irc, realuser[1]) - irc.proto.sjoinServer(getRemoteSid(irc, remoteirc), localchan, [(modes, client)]) + irc.proto.sjoin(getRemoteSid(irc, remoteirc), localchan, [(modes, client)]) if userdata and numeric in irc.users: log.info('(%s) Relay claim: Blocked KILL (reason %r) from %s to relay client %s/%s.', irc.name, args['text'], irc.users[numeric].nick, diff --git a/protocols/inspircd.py b/protocols/inspircd.py index 79077fe..762a0ee 100644 --- a/protocols/inspircd.py +++ b/protocols/inspircd.py @@ -80,7 +80,7 @@ class InspIRCdProtocol(TS6BaseProtocol): self.irc.channels[channel].users.add(client) self.irc.users[client].channels.add(channel) - def sjoinServer(self, server, channel, users, ts=None): + def sjoin(self, server, channel, users, ts=None): """Sends an SJOIN for a group of users to a channel. The sender should always be a Server ID (SID). TS is optional, and defaults @@ -88,13 +88,13 @@ class InspIRCdProtocol(TS6BaseProtocol): is a list of (prefix mode, UID) pairs: Example uses: - sjoinServer('100', '#test', [('', '100AAABBC'), ('qo', 100AAABBB'), ('h', '100AAADDD')]) - sjoinServer(self.irc.sid, '#test', [('o', self.irc.pseudoclient.uid)]) + sjoin('100', '#test', [('', '100AAABBC'), ('qo', 100AAABBB'), ('h', '100AAADDD')]) + sjoin(self.irc.sid, '#test', [('o', self.irc.pseudoclient.uid)]) """ channel = utils.toLower(self.irc, channel) server = server or self.irc.sid - assert users, "sjoinServer: No users sent?" - log.debug('(%s) sjoinServer: got %r for users', self.irc.name, users) + assert users, "sjoin: No users sent?" + log.debug('(%s) sjoin: got %r for users', self.irc.name, users) if not server: raise LookupError('No such PyLink client exists.') @@ -120,7 +120,7 @@ class InspIRCdProtocol(TS6BaseProtocol): try: self.irc.users[user].channels.add(channel) except KeyError: # Not initialized yet? - log.debug("(%s) sjoinServer: KeyError trying to add %r to %r's channel list?", self.irc.name, channel, user) + log.debug("(%s) sjoin: KeyError trying to add %r to %r's channel list?", self.irc.name, channel, user) if ts <= orig_ts: # Only save our prefix modes in the channel state if our TS is lower than or equal to theirs. utils.applyModes(self.irc, channel, changedmodes) diff --git a/protocols/ts6.py b/protocols/ts6.py index a7e25ea..cadf109 100644 --- a/protocols/ts6.py +++ b/protocols/ts6.py @@ -68,7 +68,7 @@ class TS6Protocol(TS6BaseProtocol): self.irc.channels[channel].users.add(client) self.irc.users[client].channels.add(channel) - def sjoinServer(self, server, channel, users, ts=None): + def sjoin(self, server, channel, users, ts=None): """Sends an SJOIN for a group of users to a channel. The sender should always be a Server ID (SID). TS is optional, and defaults @@ -76,8 +76,8 @@ class TS6Protocol(TS6BaseProtocol): is a list of (prefix mode, UID) pairs: Example uses: - sjoinServer('100', '#test', [('', '100AAABBC'), ('o', 100AAABBB'), ('v', '100AAADDD')]) - sjoinServer(self.irc.sid, '#test', [('o', self.irc.pseudoclient.uid)]) + sjoin('100', '#test', [('', '100AAABBC'), ('o', 100AAABBB'), ('v', '100AAADDD')]) + sjoin(self.irc.sid, '#test', [('o', self.irc.pseudoclient.uid)]) """ # https://github.com/grawity/irc-docs/blob/master/server/ts6.txt#L821 # parameters: channelTS, channel, simple modes, opt. mode parameters..., nicklist @@ -90,8 +90,8 @@ class TS6Protocol(TS6BaseProtocol): # so it is not possible to use this message to force users to join a channel. channel = utils.toLower(self.irc, channel) server = server or self.irc.sid - assert users, "sjoinServer: No users sent?" - log.debug('(%s) sjoinServer: got %r for users', self.irc.name, users) + assert users, "sjoin: No users sent?" + log.debug('(%s) sjoin: got %r for users', self.irc.name, users) if not server: raise LookupError('No such PyLink client exists.') @@ -121,7 +121,7 @@ class TS6Protocol(TS6BaseProtocol): try: self.irc.users[user].channels.add(channel) except KeyError: # Not initialized yet? - log.debug("(%s) sjoinServer: KeyError trying to add %r to %r's channel list?", self.irc.name, channel, user) + log.debug("(%s) sjoin: KeyError trying to add %r to %r's channel list?", self.irc.name, channel, user) users = users[10:] namelist = ' '.join(namelist) self._send(server, "SJOIN {ts} {channel} {modes} :{users}".format( diff --git a/protocols/unreal.py b/protocols/unreal.py index 1ffed57..cb53738 100644 --- a/protocols/unreal.py +++ b/protocols/unreal.py @@ -113,7 +113,7 @@ class UnrealProtocol(TS6BaseProtocol): self.irc.channels[channel].users.add(client) self.irc.users[client].channels.add(channel) - def sjoinServer(self, server, channel, users, ts=None): + def sjoin(self, server, channel, users, ts=None): """Sends an SJOIN for a group of users to a channel. The sender should always be a server (SID). TS is optional, and defaults @@ -121,8 +121,8 @@ class UnrealProtocol(TS6BaseProtocol): is a list of (prefix mode, UID) pairs: Example uses: - sjoinServer('100', '#test', [('', '100AAABBC'), ('o', 100AAABBB'), ('v', '100AAADDD')]) - sjoinServer(self.irc.sid, '#test', [('o', self.irc.pseudoclient.uid)]) + sjoin('100', '#test', [('', '100AAABBC'), ('o', 100AAABBB'), ('v', '100AAADDD')]) + sjoin(self.irc.sid, '#test', [('o', self.irc.pseudoclient.uid)]) Note that for UnrealIRCd, no mode data is sent in an SJOIN command, only The channel name, TS, and user list. @@ -133,7 +133,7 @@ class UnrealProtocol(TS6BaseProtocol): # '@+1JJAAAAAB +2JJAAAA4C 1JJAAAADS'. channel = utils.toLower(self.irc, channel) server = server or self.irc.sid - assert users, "sjoinServer: No users sent?" + assert users, "sjoin: No users sent?" if not server: raise LookupError('No such PyLink server exists.') @@ -159,7 +159,7 @@ class UnrealProtocol(TS6BaseProtocol): try: self.irc.users[user].channels.add(channel) except KeyError: # Not initialized yet? - log.debug("(%s) sjoinServer: KeyError trying to add %r to %r's channel list?", self.irc.name, channel, user) + log.debug("(%s) sjoin: KeyError trying to add %r to %r's channel list?", self.irc.name, channel, user) namelist = ' '.join(namelist) self._send(server, "SJOIN {ts} {channel} :{users}".format( ts=ts, users=namelist, channel=channel))