Safe Haskell | None |
---|---|
Language | Haskell2010 |
The default event handlers. Handlers are invoked concurrently when matching events are received from the server.
- defaultEventHandlers :: [EventHandler s]
- pingHandler :: UnicodeEvent -> StatefulIRC s ()
- ctcpPingHandler :: UnicodeEvent -> StatefulIRC s ()
- ctcpVersionHandler :: UnicodeEvent -> StatefulIRC s ()
- ctcpTimeHandler :: UnicodeEvent -> StatefulIRC s ()
- welcomeNick :: UnicodeEvent -> StatefulIRC s ()
- nickMangler :: UnicodeEvent -> StatefulIRC s ()
- defaultDisconnectHandler :: StatefulIRC s ()
Event handlers
defaultEventHandlers :: [EventHandler s] Source
The default event handlers, the following are included:
- respond to server
PING
messages with aPONG
; - respond to CTCP
PING
requests with a CTCPPONG
; - respond to CTCP
VERSION
requests with the version string; - respond to CTCP
TIME
requests with the system time; - update the nick upon receiving the welcome message, in case the server modifies it;
- mangle the nick if the server reports a collision;
- update the channel list on
JOIN
andKICK
.
These event handlers are all exposed through the
Network.IRC.Client.Handlers module, so you can use them directly if
you are building up your InstanceConfig
from scratch.
If you are building a bot, you may want to write an event handler to process messages representing commands.
pingHandler :: UnicodeEvent -> StatefulIRC s () Source
Respond to server PING
messages with a PONG
.
ctcpPingHandler :: UnicodeEvent -> StatefulIRC s () Source
Respond to CTCP PING
requests with a CTCP PONG
.
ctcpVersionHandler :: UnicodeEvent -> StatefulIRC s () Source
Respond to CTCP VERSION
requests with the version string.
ctcpTimeHandler :: UnicodeEvent -> StatefulIRC s () Source
Respond to CTCP TIME
requests with the system time.
welcomeNick :: UnicodeEvent -> StatefulIRC s () Source
Update the nick upon welcome (numeric reply 001), as it may not be what we requested (eg, in the case of a nick too long).
nickMangler :: UnicodeEvent -> StatefulIRC s () Source
Mangle the nick if there's a collision (numeric replies 432, 433, and 436) when we set it
Disconnect handlers
defaultDisconnectHandler :: StatefulIRC s () Source
The default disconnect handler: do nothing. You might want to override this with one which reconnects.