irc-client- An IRC client library.

Copyright(c) 2016 Michael Walker
MaintainerMichael Walker <>
PortabilityCPP, OverloadedStrings, ScopedTypeVariables
Safe HaskellNone



Most of the hairy code. This isn't all internal, due to messy dependencies, but I've tried to make this as "internal" as reasonably possible.

This module is NOT considered to form part of the public interface of this library.



setupInternal Source #


:: (IO () -> ConduitM (Either ByteString (Event ByteString)) Void IO () -> ConduitM () (Message ByteString) IO () -> IO ())

Function to start the network conduits.

-> IRC s ()

Connect handler

-> (Maybe SomeException -> IRC s ())

Disconnect handler

-> (Origin -> ByteString -> IO ())

Logging function

-> ByteString

Server hostname

-> Int

Server port

-> ConnectionConfig s 

Config to connect to a server using the supplied connection function.

runner :: IRC s () Source #

The event loop.

forgetful :: Monad m => ConduitM (Either a b) b m () Source #

Forget failed decodings.

eventSink :: MonadIO m => IORef UTCTime -> IRCState s -> ConduitM (Event ByteString) o m () Source #

Block on receiving a message and invoke all matching handlers.

isIgnored :: MonadIO m => IRCState s -> Event Text -> m Bool Source #

Check if an event is ignored or not.

logConduit :: MonadIO m => (a -> IO ()) -> ConduitM a a m () Source #

A conduit which logs everything which goes through it.

stdoutLogger :: Origin -> ByteString -> IO () Source #

Print messages to stdout, with the current time.

fileLogger :: FilePath -> Origin -> ByteString -> IO () Source #

Append messages to a file, with the current time.

noopLogger :: a -> b -> IO () Source #

Do no logging.

send :: Message Text -> IRC s () Source #

Send a message as UTF-8, using TLS if enabled. This blocks if messages are sent too rapidly.

sendBS :: Message ByteString -> IRC s () Source #

Send a message, using TLS if enabled. This blocks if messages are sent too rapidly.

disconnect :: IRC s () Source #

Disconnect from the server, properly tearing down the TLS session (if there is one).

reconnect :: IRC s () Source #

Disconnect from the server (this will wait for all messages to be sent, or a minute to pass), and then connect again.

This can be called after the client has already disconnected, in which case it will just connect again.

Like runClient and runClientWith, this will not return until the client terminates (ie, disconnects without reconnecting).

runIRCAction :: MonadIO m => IRC s a -> IRCState s -> m a Source #

Interact with a client from the outside, by using its IRCState.

getIRCState :: IRC s (IRCState s) Source #

Access the client state.

getConnectionState :: IRCState s -> STM ConnectionState Source #

Get the connection state from an IRC state.

timeoutBlock :: MonadIO m => NominalDiffTime -> IO Bool -> m () Source #

Block until an action is successful or a timeout is reached.

sourceTBMChan :: MonadIO m => TBMChan a -> ConduitM () a m () Source #

A simple wrapper around a TBMChan. As data is pushed into the channel, the source will read it and pass it down the conduit pipeline. When the channel is closed, the source will close also.

If the channel fills up, the pipeline will stall until values are read.

From stm-conduit-3.0.0 (by Clark Gaebel