From 04c18f0bd5f49c8d50e6cde2ca04cca1461448c3 Mon Sep 17 00:00:00 2001 From: James Lu Date: Sun, 25 Jun 2017 02:08:16 -0700 Subject: [PATCH] docs: get rid of self.irc, self.proto, irc.proto --- docs/technical/hooks-reference.md | 2 +- docs/technical/pmodule-spec.md | 10 +++++----- docs/technical/writing-plugins.md | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/technical/hooks-reference.md b/docs/technical/hooks-reference.md index 9038fe7..6b8306b 100644 --- a/docs/technical/hooks-reference.md +++ b/docs/technical/hooks-reference.md @@ -163,7 +163,7 @@ Some hooks do not map directly to IRC commands, but to events that protocol modu - **PYLINK_CUSTOM_WHOIS**: `{'target': UID1, 'server': SID1}` - This hook is called by `coremods/handlers.py` during its WHOIS handling process, to allow plugins to provide custom WHOIS information. The `target` field represents the target UID, while the `server` field represents the SID that should be replying to the WHOIS request. The source of the payload is the user using `/whois`. - - Plugins wishing to implement this should use the standard WHOIS numerics, using `irc.proto.numeric()` to reply to the source from the given server. + - Plugins wishing to implement this should use the standard WHOIS numerics, using `irc.numeric()` to reply to the source from the given server. - This hook replaces the pre-0.8.x fashion of defining custom WHOIS handlers, which was non-standard and poorly documented. ## Commands handled WITHOUT hooks diff --git a/docs/technical/pmodule-spec.md b/docs/technical/pmodule-spec.md index 85fd6cc..407f850 100644 --- a/docs/technical/pmodule-spec.md +++ b/docs/technical/pmodule-spec.md @@ -77,7 +77,7 @@ internals](https://github.com/GLolol/PyLink/blob/1.0-beta1/classes.py#L474-L483) - **`sjoin`**`(self, server, channel, users, ts=None, modes=set())` - 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: - `sjoin('100', '#test', [('', '100AAABBC'), ('qo', 100AAABBB'), ('h', '100AAADDD')])` - - `sjoin(self.irc.sid, '#test', [('o', self.irc.pseudoclient.uid)])` + - `sjoin(self.sid, '#test', [('o', self.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. @@ -105,7 +105,7 @@ A protocol module should also set the following variables in their protocol clas A protocol module manipulates the following attributes in the IRC object it is attached to: -- `self.irc.cmodes` / `self.irc.umodes`: These are mappings of named IRC modes (e.g. `inviteonly` or `moderated`) to a string list of mode letters, that should be either set during link negotiation or hardcoded into the protocol module. There are also special keys: `*A`, `*B`, `*C`, and `*D`, which **must** be set properly with a list of mode characters for that type of mode. +- `self.cmodes` / `self.umodes`: These are mappings of named IRC modes (e.g. `inviteonly` or `moderated`) to a string list of mode letters, that should be either set during link negotiation or hardcoded into the protocol module. There are also special keys: `*A`, `*B`, `*C`, and `*D`, which **must** be set properly with a list of mode characters for that type of mode. - Types of modes are defined as follows (from http://www.irc.org/tech_docs/005.html): - A = Mode that adds or removes a nick or address to a list. Always has a parameter. - B = Mode that changes a setting and always has a parameter. @@ -114,8 +114,8 @@ A protocol module manipulates the following attributes in the IRC object it is a - If not defined, these will default to modes defined by RFC 1459: https://github.com/GLolol/PyLink/blob/1.0-beta1/classes.py#L127-L152 - An example of mode mapping hardcoding can be found here: https://github.com/GLolol/PyLink/blob/1.0-beta1/protocols/ts6.py#L259-L311 - You can find a list of supported (named) channel modes [here](channel-modes.csv), and a list of user modes [here](user-modes.csv). -- `self.irc.prefixmodes`: This defines a mapping of prefix modes (+o, +v, etc.) to their respective mode prefix. This will default to `{'o': '@', 'v': '+'}` (the standard op and voice) if not defined. - - Example: `self.irc.prefixmodes = {'o': '@', 'h': '%', 'v': '+'}` +- `self.prefixmodes`: This defines a mapping of prefix modes (+o, +v, etc.) to their respective mode prefix. This will default to `{'o': '@', 'v': '+'}` (the standard op and voice) if not defined. + - Example: `self.prefixmodes = {'o': '@', 'h': '%', 'v': '+'}` ### Topics @@ -167,7 +167,7 @@ As an example, one protocol module that tweaks this is [`Clientbot`](https://git ## Changes * 2017-03-15 (1.2-dev) - - Corrected the location of `self.irc.cmodes/umodes/prefixmodes` attributes + - Corrected the location of `self.cmodes/umodes/prefixmodes` attributes - Mention `self.conf_keys` as a special variable for completeness * 2017-01-29 (1.2-dev) - NOTICE can now be sent from servers. diff --git a/docs/technical/writing-plugins.md b/docs/technical/writing-plugins.md index 649fb0e..de68fea 100644 --- a/docs/technical/writing-plugins.md +++ b/docs/technical/writing-plugins.md @@ -46,7 +46,7 @@ Command handlers do not return anything and can raise exceptions, which are caug 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.command(arg1, arg2, ...)`. For example, the command `irc.proto.join('10XAAAAAB', '#bots')` would join a PyLink client with UID `10XAAAAAB` to channel `#bots`. +These functions are usually called in this fashion: `irc.command(arg1, arg2, ...)`. For example, the command `irc.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: