irc-0.6.1.0: A small library for parsing IRC messages.
Safe HaskellSafe
LanguageHaskell2010

Network.IRC.Base

Description

Datatypes for representing IRC messages, as well as formatting them.

Synopsis

Type Synonyms

type Parameter = ByteString Source #

type ServerName = ByteString Source #

type UserName = ByteString Source #

type RealName = ByteString Source #

type Command = ByteString Source #

IRC Datatypes

data Prefix Source #

The optional beginning of an IRC messages

Constructors

Server ServerName

Server Prefix

NickName ByteString (Maybe UserName) (Maybe ServerName)

Nickname Prefix

Instances

Instances details
Eq Prefix Source # 
Instance details

Defined in Network.IRC.Base

Methods

(==) :: Prefix -> Prefix -> Bool

(/=) :: Prefix -> Prefix -> Bool

Read Prefix Source # 
Instance details

Defined in Network.IRC.Base

Methods

readsPrec :: Int -> ReadS Prefix

readList :: ReadS [Prefix]

readPrec :: ReadPrec Prefix

readListPrec :: ReadPrec [Prefix]

Show Prefix Source # 
Instance details

Defined in Network.IRC.Base

Methods

showsPrec :: Int -> Prefix -> ShowS

show :: Prefix -> String

showList :: [Prefix] -> ShowS

data Message Source #

IRC messages are parsed as: [ : prefix space ] command { space param } crlf

Constructors

Message 

Instances

Instances details
Eq Message Source # 
Instance details

Defined in Network.IRC.Base

Methods

(==) :: Message -> Message -> Bool

(/=) :: Message -> Message -> Bool

Read Message Source # 
Instance details

Defined in Network.IRC.Base

Methods

readsPrec :: Int -> ReadS Message

readList :: ReadS [Message]

readPrec :: ReadPrec Message

readListPrec :: ReadPrec [Message]

Show Message Source # 
Instance details

Defined in Network.IRC.Base

Methods

showsPrec :: Int -> Message -> ShowS

show :: Message -> String

showList :: [Message] -> ShowS

Formatting functions

encode :: Message -> ByteString Source #

Encode a message to its string representation

showMessage :: Message -> ByteString Source #

showPrefix :: Prefix -> ByteString Source #

showParameters :: [Parameter] -> ByteString Source #

translateReply Source #

Arguments

:: Command

Reply

-> ByteString

Text translation

Translate a reply into its text description. If no text is available, the argument is returned.

replyTable :: [(ByteString, ByteString)] Source #

Deprecated

render :: Message -> ByteString Source #

This is the deprecated version of encode