diff --git a/docs/technical/hooks-reference.md b/docs/technical/hooks-reference.md index 4eeebfe..55fa5dc 100644 --- a/docs/technical/hooks-reference.md +++ b/docs/technical/hooks-reference.md @@ -29,31 +29,53 @@ Some hooks, like MODE, are more complex and can include the entire state of a ch ['001ZJZW01', 'MODE', {'modes': [('+o', '38QAAAAAA')], - 'oldchan': {'modes': set(), - 'prefixmodes': {'admins': set(), - 'halfops': set(), - 'ops': set(), - 'owners': set(), - 'voices': set()}, - 'topic': '', - 'topicset': False, - 'ts': 1451169448, - 'users': {'38QAAAAAA', '001ZJZW01'}}, + 'oldchan': IrcChannel({'modes': set(), + 'prefixmodes': {'admins': set(), + 'halfops': set(), + 'ops': set(), + 'owners': set(), + 'voices': set()}, + 'topic': '', + 'topicset': False, + 'ts': 1451169448, + 'users': {'38QAAAAAA', '001ZJZW01'}}), 'target': '#chat', 'ts': 1451174702}] ``` ## Core hooks -The following hooks are required for PyLink's basic functioning. +The following hooks, sent with their correct data keys, are required for PyLink's basic functioning. -- **ENDBURST**: `{}` - Although the hook data is empty, this should be sent whenever a server finishes its burst. The sender should be the server that finishes bursting. -
-Plugins like Relay need this to know that the uplink has finished bursting all its users! +- **ENDBURST**: `{}` + - The hook data here is empty. + - This payload should be sent whenever a server finishes its burst, with the SID of the bursted server as the sender. + - Plugins like Relay need this to know that the uplink has finished bursting all its users! -- **PYLINK_DISCONNECT**: `{}` - This is sent to plugins by the IRC objects when their network has disconnected. The sender (numeric) is **None** in this case. +- **PYLINK_DISCONNECT**: `{}` + - This is sent to plugins by IRC object instances whenever their network has disconnected. The sender (numeric) here is always **None**. + +- **PYLINK_SPAWNMAIN**: `{'olduser': olduserobj}` + - This is sent whenever `Irc.spawnMain()` is called to (re)spawn the main PyLink client, for example to rejoin it from a KILL. It basically tells plugins that the UID of the main PyLink client has changed, while giving them the old data too. + - Example payload: + + - ``` +{'olduser': IrcUser({'away': '', + 'channels': {'#chat'}, + 'host': 'pylink-devel.overdrivenetworks.com', + 'ident': 'pylink', + 'identified': False, + 'ip': '0.0.0.0', + 'manipulatable': True, + 'modes': {('o', None)}, + 'nick': 'PyLink-devel', + 'realhost': 'pylink-devel.overdrivenetworks.com', + 'realname': 'PyLink development server', + 'ts': 1452393682, + 'uid': '7PYAAAAAE'}), + 'ts': 1452393899)} +``` -- **PYLINK_SPAWNMAIN**: `{'olduser': olduserobj}` - This is sent whenever `Irc.spawnMain()` is called to (re)spawn the main PyLink client, for example to rejoin it from a KILL. It basically tells plugins that the UID of the main PyLink client has changed, while giving them the old data too. ## IRC command hooks diff --git a/docs/technical/pmodule-spec.md b/docs/technical/pmodule-spec.md index 50c1263..c7f3b06 100644 --- a/docs/technical/pmodule-spec.md +++ b/docs/technical/pmodule-spec.md @@ -79,7 +79,7 @@ optional, and defaults to the one we've stored in the channel state if not given - `sjoinServer('100', '#test', [('', '100AAABBC'), ('qo', 100AAABBB'), ('h', '100AAADDD')])` - `sjoinServer(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. +- **`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. - **`squitServer`**`(self, source, target, text='No reason given')` - SQUITs a PyLink server.