- Impact: irccd
- Status: implemented
- Target version: 3.1.0
The key idea is to offer to irccd a way to call external scripts upon receptions of IRC messages. Thus one can use any language to write its own set of actions.
Comparison to plugins¶
While both hooks and plugins provide a way to extend irccd, they have different aspects.
- Plugins are permanently loaded while hooks are evaluated only when required. On the other hand, starting hooks on demand takes slightly more time than calling plugins.
- Hooks are much less powerful than plugins, you need to call
irccdctlto respond to events.
- Hooks can not use the irccd templates nor rules systems.
Hooks are simply defined in the
irccd.conf file under a new section
hooks. Then user adds any key-value pair as necessary for every hook. The key is used as hook identifier.
[hooks] database = "/bin/store-all.sh"
The IRC events are passed as arguments in the form
- onCommand server origin channel message
- onConnect server
- onDisconnect server
- onInvite server origin channel
- onJoin server origin channel
- onKick server origin channel target reason
- onMe server origin channel message
- onMessage server origin channel message
- onNick server origin nickname
- onPart server origin channel reason
- onTopic server origin channel topic
Note: for the moment onNames and onWhois are deferred.
The following commands are available.
List all hooks and their status, for security purposes the path is not shown.
$ irccdctl hook-list database enabled destroyer disabled
hook-enable and hook-disable¶
Basically self explanatory
$ irccdctl hook-enable destroyer $ irccdctl hook-disable database