irc-fun-client-0.4.0.0: Another library for writing IRC clients.

Safe HaskellNone
LanguageHaskell2010

Network.IRC.Fun.Client.Events

Description

This module allows you to identify IRC events. Events are a wrapper around IRC messages, which provide a logical layer convenient to work with (while IRC messages have their lower level aspects, being plain protocol messages).

Synopsis

Documentation

data Event Source

An event triggered by an IRC message sent from the server.

Constructors

Ping String (Maybe String)

A ping was sent to the bot. The parameters are the server name and optionally a server to forward the response to. They can be passed as-is directly to the PONG response.

Pong String (Maybe String)

A ping response sent by the server.

Kick String [String] (Maybe String)

One or more users have been kicked from a channel for an optionally given reason. Parameters: Channel, nicknames, reason.

Join String String

A user joined a channel. Parameters: Channel, nickname.

Part String String (Maybe String)

A user left a channel, optionally with a given reason. Parameters: Channel, nickname, reason.

Quit String (Maybe String)

A user left the network, optonally for the given reason. Parameters: Nickname, reason.

Mode

TODO

ChannelMessage String String String Bool

Message sent in a channel by a user. The last parameter indicates whether the message is actually a notice. If yes, the client shouldn't automatically send a response. Parameters: Channel, nickname, message, whether notice.

ChannelAction String String String

A channel message that is a virtual action (/me).

PrivateMessage String String Bool

A private message sent specifically to the client from a user. The last parameter indicates whether the message is actually a notice. If yes, the client shouldn't send any automatic response. Parameters: Nickname, message, whether notice.

PrivateAction String String

A private message that is a virtual action (/me).

NickChange String String

A user's nickname has changed. Parameters: Old nick, new nick.

Topic String String String

Channel topic change. Parameterss: Channel, nickname of user who changed the topic, new topic content.

Invite String String

The client has been invited to a channel by another user. Parameters: Channel, nickname of inviting user.

Names ChannelPrivacy String [(Privilege, String)]

The server sent a list of nicknames present in a channel. Parameters: Channel privacy mode, channel name, list of users. Each list item is a pair of a user privilege level in the channel, and the user's nickname.

OtherEvent String 

Instances

data Privilege :: *

Constructors

Regular 
Voice 
Operator 

detectEvents :: Either SpecificReply SpecificMessage -> Either String [Event] Source

Try to generate events from an IRC message. If it fails, Left an error message is returned. Otherwise, Right a list of generated events is returned.

hGetIrcEventsOnce :: Handle -> IO (Maybe [Event]) Source

Receive IRC events. If parsing and detecting the events fails, Nothing is returned.

hGetIrcEventsOnce' :: Handle -> IO (Either String [Event]) Source

A variant of hGetIrcEventsOnce which returns Left an error message if parsing or detection fails.

hGetIrcEvents :: Handle -> IO [Event] Source

Receive the next valid (successfully parsed and detected) series of IRC events.

hGetIrcEvents' :: Handle -> IO ([String], [Event]) Source

A variant of hGetIrcEvents which returns a list of error messages for received IRC lines whose parsing/event detection failed.