glirc-2.19: Console IRC client

Copyright(c) Eric Mertens, 2016
LicenseISC
Maintaineremertens@gmail.com
Safe HaskellNone
LanguageHaskell2010

Client.State.Network

Contents

Description

This module is responsible for tracking the state of an individual IRC connection while the client is connected to it. This state includes user information, server settings, channel membership, and more.

This module is more complicated than many of the other modules in the client because it is responsible for interpreting each IRC message from the server and updating the connection state accordingly.

Synopsis

Connection state

data NetworkState Source #

State tracked for each IRC connection

Constructors

NetworkState 

Fields

data AuthenticateState Source #

State of the authentication transaction

Constructors

AS_None

no active transaction

AS_PlainStarted

PLAIN mode initiated

AS_EcdsaStarted

ECDSA-NIST mode initiated

AS_EcdsaWaitChallenge

ECDSA_NIST user sent waiting for challenge

newNetworkState Source #

Arguments

:: NetworkId

unique network ID

-> Text

network name

-> ServerSettings

server settings

-> NetworkConnection

active network connection

-> PingStatus

initial ping status

-> NetworkState

new network state

Construct a new network state using the given settings and default values as specified by the IRC specification.

Lenses

User information

data UserAndHost Source #

Pair of username and hostname. Empty strings represent missing information.

Constructors

UserAndHost !Text !Text

username hostname

Cross-message state

Connection predicates

iHaveOp :: Identifier -> NetworkState -> Bool Source #

Predicate to test if the connection has op in a given channel.

Messages interactions

sendMsg :: NetworkState -> RawIrcMsg -> IO () Source #

Transmit a RawIrcMsg on the connection associated with the given network. For PRIVMSG and NOTICE overlong commands are detected and transmitted as multiple messages.

squelchIrcMsg :: IrcMsg -> Bool Source #

Return True for messages that should be hidden outside of full detail view. These messages are interpreted by the client so the user shouldn't need to see them directly to get the relevant information.

Timer information

data PingStatus Source #

Status of the ping timer

Constructors

PingSent !UTCTime

ping sent waiting for pong

PingLatency !Double

latency in seconds for last ping

PingNever

no ping sent

PingConnecting !Int !(Maybe UTCTime)

number of attempts, last known connection time

nextTimedAction :: NetworkState -> Maybe (UTCTime, TimedAction) Source #

Compute the earliest timed action for a connection, if any

applyTimedAction :: TimedAction -> NetworkState -> IO NetworkState Source #

Apply the given TimedAction to a connection state.

Moderation

useChanServ Source #

Arguments

:: Identifier

channel

-> NetworkState

network state

-> Bool

chanserv available

sendModeration Source #

Arguments

:: Identifier

channel

-> [RawIrcMsg]

commands

-> NetworkState

network state

-> IO NetworkState 

Used to send commands that require ops to perform. If this channel is one that the user has chanserv access and ops are needed then ops are requested and the commands are queued, otherwise send them directly.

sendTopic Source #

Arguments

:: Identifier

channel

-> Text

topic

-> NetworkState

network state

-> IO ()