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

Safe Haskell | Safe-Inferred

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

# Type Synonyms

type Parameter = String Source

type ServerName = String Source

type UserName = String Source

type RealName = String Source

type Command = String Source

# IRC Datatypes

data Prefix Source

The optional beginning of an IRC messages

Constructors

Server ServerName | Server Prefix
NickName String (Maybe UserName) (Maybe ServerName) | Nickname Prefix

Instances

Eq Prefix |
Read Prefix |
Show Prefix |

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 |
Read Message |
Show Message |

# Formatting functions

encode :: Message -> String Source

Encode a message to its string representation

showMessage :: Message -> String Source

showPrefix :: Prefix -> String Source

showParameters :: [Parameter] -> String Source

translateReply Source

Arguments

:: Command | Reply
-> String | Text translation

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

replyTable :: [(String, String)]Source

# Deprecated

render :: Message -> String Source

This is the deprecated version of encode