irc-core-1.0: An IRC client library and text client

Safe HaskellNone
LanguageHaskell2010

Irc.Model

Contents

Description

This module implements a high-level view of the state of the IRC connection. The library user calls advanceModel to step the IrcConnection as new messages arrive.

Synopsis

IRC Connection model

defaultIrcConnection :: IrcConnection Source

IrcConnection value with everything unspecified

Phases

IRC Channel model

data IrcChannel Source

IrcChannel represents the current state of a channel as seen on the connection. It includes all user lists, modes, and other metadata about a channel.

Mode Settings

data ModeTypes Source

Settings that describe how to interpret channel modes

defaultChanModeTypes :: ModeTypes Source

The channel modes used by Freenode

defaultUmodeTypes :: ModeTypes Source

The default UMODE as defined by Freenode

Channel Mask Entry

data IrcMaskEntry Source

Mask entries are used to represent an entry in a ban list for a channel.

User metadata

data IrcUser Source

IrcUser is the type of user-level metadata tracked for the users visible on the current IRC connection.

Constructors

IrcUser 

defaultIrcUser :: IrcUser Source

This represents the metadata of an unknown user.

Model execution

runLogic :: (Functor m, Monad m) => UTCTime -> (forall r. LogicOp r -> m r) -> Logic a -> m (Either String a) Source

Execute the Logic value using a given operation for sending and recieving IRC messages.

General functionality

advanceModel :: MsgFromServer -> IrcConnection -> Logic IrcConnection Source

Primary state machine step function. Call this function with a timestamp and a server message to update the IrcConnection state. If additional messages are required they will be requested via the Logic type.

isChannelName :: Identifier -> IrcConnection -> Bool Source

Predicate for identifiers to identify which represent channel names. Channel prefixes are configurable, but the most common is #

isNickName :: Identifier -> IrcConnection -> Bool Source

Predicate for identifiers to identify which represent nicknames

isMyNick :: Identifier -> IrcConnection -> Bool Source

Predicate to determine if a given identifier is the primary nick for the given connection.

splitModes Source

Arguments

:: ModeTypes

mode interpretation

-> ByteString

modes

-> [ByteString]

arguments

-> Maybe [(Bool, Char, ByteString)] 

Split up a mode change command and arguments into individual changes given a configuration.

nickHasModeInChannel Source

Arguments

:: Identifier

nick

-> Char

mode

-> Identifier

channel

-> IrcConnection 
-> Bool 

channelHasMode Source

Arguments

:: Identifier

channel

-> Char

mode

-> IrcConnection 
-> Bool