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

Safe Haskell | Safe
Language | Haskell2010

Network.IRC.Base

Contents

- Type Synonyms
- IRC Datatypes
- Formatting functions
- Deprecated

Description

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

Synopsis

- type Parameter = ByteString
- type ServerName = ByteString
- type UserName = ByteString
- type RealName = ByteString
- type Command = ByteString
- data Prefix
  - = Server ServerName
  - | NickName ByteString (Maybe UserName) (Maybe ServerName)
- data Message = Message {
  - msg_prefix :: Maybe Prefix
  - msg_command :: Command
  - msg_params :: [Parameter]
  }
- encode :: Message -> ByteString
- showMessage :: Message -> ByteString
- showPrefix :: Prefix -> ByteString
- showParameters :: [Parameter] -> ByteString
- translateReply :: Command -> ByteString
- replyTable :: [(ByteString, ByteString)]
- render :: Message -> ByteString

# 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

Eq Prefix Source |
Read Prefix Source |
Show Prefix Source |

data Message Source

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

Constructors

Message |

Fields

msg_prefix :: Maybe Prefix
msg_command :: Command
msg_params :: [Parameter]

Instances

Eq Message Source |
Read Message Source |
Show Message Source |

# 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