diff --git a/classes.py b/classes.py index 9e3f7ee..c103653 100644 --- a/classes.py +++ b/classes.py @@ -392,7 +392,7 @@ class Irc(): modes={("+o", None)}, manipulatable=True) for chan in self.serverdata['channels']: - self.proto.joinClient(self.pseudoclient.uid, chan) + self.proto.join(self.pseudoclient.uid, chan) # PyLink internal hook called when spawnMain is called and the # contents of Irc().pseudoclient change. self.callHooks([self.sid, 'PYLINK_SPAWNMAIN', {'olduser': olduserobj}]) @@ -670,7 +670,7 @@ class FakeProto(Protocol): self.irc.users[uid] = user = IrcUser(nick, ts, uid) return user - def joinClient(self, client, channel): + def join(self, client, channel): self.irc.channels[channel].users.add(client) self.irc.users[client].channels.add(channel) diff --git a/coreplugin.py b/coreplugin.py index cd10ca1..aedb809 100644 --- a/coreplugin.py +++ b/coreplugin.py @@ -20,7 +20,7 @@ def handle_kick(irc, source, command, args): kicked = args['target'] channel = args['channel'] if kicked == irc.pseudoclient.uid: - irc.proto.joinClient(irc.pseudoclient.uid, channel) + irc.proto.join(irc.pseudoclient.uid, channel) utils.add_hook(handle_kick, 'KICK') def handle_commands(irc, source, command, args): diff --git a/docs/technical/pmodule-spec.md b/docs/technical/pmodule-spec.md index c7f3b06..0bdc026 100644 --- a/docs/technical/pmodule-spec.md +++ b/docs/technical/pmodule-spec.md @@ -42,7 +42,7 @@ internals](https://github.com/GLolol/PyLink/blob/0.4.0-dev/classes.py#L267-L272) - The `manipulatable` option toggles whether the client spawned should be considered protected. Currently, all this does is prevent commands from plugins like `bots` from modifying these clients, but future client protections (anti-kill flood, etc.) may also depend on this. - The `server` option optionally takes a SID of any PyLink server, and spawns the client on the one given. It will default to the root PyLink server. -- **`joinClient`**`(self, client, channel)` - Joins the given client UID given to a channel. +- **`join`**`(self, client, channel)` - Joins the given client UID given to a channel. - **`awayClient`**`(self, source, text)` - Sends an AWAY message from a PyLink client. `text` can be an empty string to unset AWAY status. diff --git a/docs/technical/writing-plugins.md b/docs/technical/writing-plugins.md index bdf9e01..8714977 100644 --- a/docs/technical/writing-plugins.md +++ b/docs/technical/writing-plugins.md @@ -65,7 +65,7 @@ world.whois_handlers.append(relayWhoisHandler) Plugins receive data from the underlying protocol module, and communicate back using outgoing [command functions](pmodule-spec.md) implemented by the protocol module. They should *never* send raw data directly back to IRC, because that wouldn't be portable across different IRCds. -These functions are usually called in this fashion: `irc.proto.abcdClient(arg1, arg2)`. For example, the command `irc.proto.joinClient('10XAAAAAB', '#bots')` would join a PyLink client with UID `10XAAAAAB` to channel `#bots`. +These functions are usually called in this fashion: `irc.proto.abcdClient(arg1, arg2)`. For example, the command `irc.proto.join('10XAAAAAB', '#bots')` would join a PyLink client with UID `10XAAAAAB` to channel `#bots`. For sending messages (e.g. replies to commands), simpler forms of: diff --git a/plugins/bots.py b/plugins/bots.py index ece7e61..a9b0862 100644 --- a/plugins/bots.py +++ b/plugins/bots.py @@ -67,7 +67,7 @@ def joinclient(irc, source, args): if not utils.isChannel(channel): irc.reply("Error: Invalid channel name %r." % channel) return - irc.proto.joinClient(u, channel) + irc.proto.join(u, channel) irc.callHooks([u, 'PYLINK_BOTSPLUGIN_JOIN', {'channel': channel, 'users': [u], 'modes': irc.channels[channel].modes, 'parse_as': 'JOIN'}]) diff --git a/plugins/relay.py b/plugins/relay.py index b151c23..753ddb6 100644 --- a/plugins/relay.py +++ b/plugins/relay.py @@ -381,7 +381,7 @@ def initializeChannel(irc, channel): log.debug('(%s) initializeChannel: joining our (%s) users: %s', irc.name, remotenet, irc.channels[channel].users) relayJoins(irc, channel, irc.channels[channel].users, irc.channels[channel].ts) if irc.pseudoclient.uid not in irc.channels[channel].users: - irc.proto.joinClient(irc.pseudoclient.uid, channel) + irc.proto.join(irc.pseudoclient.uid, channel) def removeChannel(irc, channel): """Destroys a relay channel by parting all of its users.""" @@ -516,7 +516,7 @@ def relayJoins(irc, channel, users, ts, burst=True): remoteirc.proto.sjoinServer(rsid, remotechan, queued_users, ts=ts) relayModes(irc, remoteirc, getRemoteSid(irc, remoteirc), channel, irc.channels[channel].modes) else: - remoteirc.proto.joinClient(queued_users[0][1], remotechan) + remoteirc.proto.join(queued_users[0][1], remotechan) def relayPart(irc, channel, user): for name, remoteirc in world.networkobjects.items(): diff --git a/protocols/inspircd.py b/protocols/inspircd.py index 424c446..ff2be4c 100644 --- a/protocols/inspircd.py +++ b/protocols/inspircd.py @@ -62,7 +62,7 @@ class InspIRCdProtocol(TS6BaseProtocol): self._operUp(uid, opertype=opertype or 'IRC Operator') return u - def joinClient(self, client, channel): + def join(self, client, channel): """Joins a PyLink client to a channel.""" # InspIRCd doesn't distinguish between burst joins and regular joins, # so what we're actually doing here is sending FJOIN from the server, diff --git a/protocols/ts6.py b/protocols/ts6.py index 6c459f0..120aa99 100644 --- a/protocols/ts6.py +++ b/protocols/ts6.py @@ -56,7 +56,7 @@ class TS6Protocol(TS6BaseProtocol): realhost=realhost)) return u - def joinClient(self, client, channel): + def join(self, client, channel): """Joins a PyLink client to a channel.""" channel = utils.toLower(self.irc, channel) # JOIN: diff --git a/protocols/unreal.py b/protocols/unreal.py index ebbead3..81e6330 100644 --- a/protocols/unreal.py +++ b/protocols/unreal.py @@ -104,7 +104,7 @@ class UnrealProtocol(TS6BaseProtocol): return u - def joinClient(self, client, channel): + def join(self, client, channel): """Joins a PyLink client to a channel.""" channel = utils.toLower(self.irc, channel) if not self.irc.isInternalClient(client): diff --git a/tests/tests_common.py b/tests/tests_common.py index 950dfe7..d8fd269 100644 --- a/tests/tests_common.py +++ b/tests/tests_common.py @@ -27,14 +27,14 @@ class PluginTestCase(unittest.TestCase): class CommonProtoTestCase(PluginTestCase): def testJoinClient(self): u = self.u - self.proto.joinClient(u, '#Channel') + self.proto.join(u, '#Channel') self.assertIn(u, self.irc.channels['#channel'].users) # Non-existant user. - self.assertRaises(LookupError, self.proto.joinClient, '9PYZZZZZZ', '#test') + self.assertRaises(LookupError, self.proto.join, '9PYZZZZZZ', '#test') def testKickClient(self): target = self.proto.spawnClient('soccerball', 'soccerball', 'abcd').uid - self.proto.joinClient(target, '#pylink') + self.proto.join(target, '#pylink') self.assertIn(self.u, self.irc.channels['#pylink'].users) self.assertIn(target, self.irc.channels['#pylink'].users) self.proto.kickClient(self.u, '#pylink', target, 'Pow!') @@ -60,13 +60,13 @@ class CommonProtoTestCase(PluginTestCase): def testPartClient(self): u = self.u - self.proto.joinClient(u, '#channel') + self.proto.join(u, '#channel') self.proto.partClient(u, '#channel') self.assertNotIn(u, self.irc.channels['#channel'].users) def testQuitClient(self): u = self.proto.spawnClient('testuser3', 'moo', 'hello.world').uid - self.proto.joinClient(u, '#channel') + self.proto.join(u, '#channel') self.assertRaises(LookupError, self.proto.quitClient, '9PYZZZZZZ', 'quit reason') self.proto.quitClient(u, 'quit reason') self.assertNotIn(u, self.irc.channels['#channel'].users)