glirc-2.33.1: Console IRC client

Copyright(c) Eric Mertens 2016
Safe HaskellNone




This module creates network connections and thread to manage those connections. Events on these connections will be written to a given event queue, and outgoing messages are recieved on an incoming event queue.

These network connections are rate limited for outgoing messages per the rate limiting algorithm given in the IRC RFC.

Incoming network event messages are assumed to be framed by newlines.

When a network connection terminates normally its final messages will be NetworkClose. When it terminates abnormally its final message will be NetworkError.



data NetworkConnection Source #

Handle for a network connection

data NetworkEvent Source #

The sum of incoming events from a network connection. All events are annotated with a network ID matching that given when the connection was created as well as the time at which the message was recieved.


NetworkOpen !ZonedTime [Text]

Event for successful connection to host (certificate lines)

NetworkLine !ZonedTime !ByteString

Event for a new recieved line (newline removed)

NetworkError !ZonedTime !SomeException

Report an error on network connection network connection failed

NetworkClose !ZonedTime

Final message indicating the network connection finished

createConnection Source #


:: Int

delay in seconds

-> ServerSettings 
-> IO NetworkConnection 

Initiate a new network connection according to the given ServerSettings. All events on this connection will be added to the given queue. The resulting NetworkConnection value can be used for sending outgoing messages and for early termination of the connection.

send :: NetworkConnection -> ByteString -> IO () Source #

Schedule a message to be transmitted on the network connection. These messages are sent unmodified. The message should contain a newline terminator.

Abort connections

abortConnection :: TerminationReason -> NetworkConnection -> IO () Source #

Force the given connection to terminate.

data TerminationReason Source #

Exceptions used to kill connections manually.



sent when ping timer expires


sent when client commands force disconnect


sent when the client disconnects due to sts policy

BadCertFingerprint ByteString (Maybe ByteString) 
BadPubkeyFingerprint ByteString (Maybe ByteString)