irc-client-0.4.4.1: An IRC client library.

Copyright(c) 2016 Michael Walker
LicenseMIT
MaintainerMichael Walker <mike@barrucadu.co.uk>
Stabilityexperimental
PortabilityCPP, OverloadedStrings
Safe HaskellNone
LanguageHaskell2010

Network.IRC.Client.Handlers

Contents

Description

The default event handlers. Handlers are invoked concurrently when matching events are received from the server.

Synopsis

Event handlers

defaultEventHandlers :: [EventHandler s] Source #

The default event handlers, the following are included:

  • respond to server PING messages with a PONG;
  • respond to CTCP PING requests with a CTCP PONG;
  • 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 and KICK.

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).

joinOnWelcome :: UnicodeEvent -> StatefulIRC s () Source #

Join default channels upon welcome (numeric reply 001). If sent earlier, the server might reject the JOIN attempts.

nickMangler :: UnicodeEvent -> StatefulIRC s () Source #

Mangle the nick if there's a collision (numeric replies 432, 433, and 436) when we set it

Special handlers

defaultOnConnect :: StatefulIRC s () Source #

The default connect handler: set the nick.

defaultOnDisconnect :: StatefulIRC s () Source #

The default disconnect handler: do nothing. You might want to override this with one which reconnects.