irc-core-1.1.5: 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

Ping information

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

defaultChanModeTypes :: ModeTypes Source #

The channel modes used by Freenode

defaultUmodeTypes :: ModeTypes Source #

The default UMODE as defined by Freenode

Channel Mask Entry

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.

data LogicOp r Source #

Instances

Functor LogicOp Source # 

Methods

fmap :: (a -> b) -> LogicOp a -> LogicOp b #

(<$) :: a -> LogicOp b -> LogicOp a #

data Logic a Source #

Instances

Monad Logic Source # 

Methods

(>>=) :: Logic a -> (a -> Logic b) -> Logic b #

(>>) :: Logic a -> Logic b -> Logic b #

return :: a -> Logic a #

fail :: String -> Logic a #

Functor Logic Source # 

Methods

fmap :: (a -> b) -> Logic a -> Logic b #

(<$) :: a -> Logic b -> Logic a #

Applicative Logic Source # 

Methods

pure :: a -> Logic a #

(<*>) :: Logic (a -> b) -> Logic a -> Logic b #

(*>) :: Logic a -> Logic b -> Logic b #

(<*) :: Logic a -> Logic b -> Logic a #

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