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, RankNTypes, ScopedTypeVariables
Safe HaskellNone
LanguageHaskell2010

Network.IRC.Client.Internal

Contents

Description

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.

Synopsis

Connecting to an IRC network

connectInternal Source #

Arguments

:: MonadIO m 
=> (IO () -> Consumer (Either ByteString IrcEvent) IO () -> Producer IO IrcMessage -> IO ())

Function to start the network conduits.

-> StatefulIRC s ()

Connect handler

-> StatefulIRC s ()

Disconnect handler

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

Logging function

-> ByteString

Server hostname

-> Int

Server port

-> NominalDiffTime

Flood timeout

-> m (ConnectionConfig s) 

Connect to a server using the supplied connection function.

Event loop

runner :: StatefulIRC s () Source #

The event loop.

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

Forget failed decodings.

eventSink :: MonadIO m => IRCState s -> Consumer IrcEvent m () Source #

Block on receiving a message and invoke all matching handlers concurrently.

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

Check if an event is ignored or not.

getHandlersFor :: Event a -> [EventHandler s] -> [UnicodeEvent -> StatefulIRC s ()] Source #

Get the event handlers for an event.

logConduit :: MonadIO m => (a -> IO ()) -> Conduit a m a 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.

Messaging

send :: UnicodeMessage -> StatefulIRC s () Source #

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

sendBS :: IrcMessage -> StatefulIRC s () Source #

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

Disconnecting

disconnect :: StatefulIRC s () Source #

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

disconnectNow :: StatefulIRC s () Source #

Disconnect immediately, without waiting for messages to be sent.

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

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