In PyLink, protocol modules communicate with plugins through a system of hooks. This has the benefit of being IRCd-independent, allowing most plugins to function regardless of the IRCd being used.
Each hook payload is formatted as a Python `list`, with three arguments `(numeric, command, args)`:
1) **numeric**: The sender of the message (UID).
2) **command**: The command name (hook name) of the payload. These are *always* UPPERCASE, and those starting with "PYLINK_" indicate hooks sent out by IRC objects themselves, that don't require protocol modules to send.
3) **args**: The hook data (args), a Python `dict`, with different data keys depending on the command given.
Note that the `ts` key is *automatically added* (using the current time) to all hook data dicts that don't include it - such a key should only be provided if the command the uplink IRCd send has a TS value itself.
On UnrealIRCd, because SETHOST is mapped to CHGHOST, `:GL SETHOST blah` would return the raw hook data of this (with the nick converted into UID by the UnrealIRCd protocol module):
Some hooks, like MODE, are more complex and can include the entire state of a channel! This will be further described later. `:GL MODE #chat +o PyLink-devel` is converted into (pretty-printed for readability):
The following hooks, sent with their correct data keys, are required for PyLink's basic functioning.
- **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 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.