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 # |
Instance details Defined in Network.IRC.Base Methods (==) :: Prefix -> Prefix -> Bool Source # (/=) :: Prefix -> Prefix -> Bool Source #
Read Prefix Source # |
Instance details Defined in Network.IRC.Base Methods readsPrec :: Int -> ReadS Prefix Source # readList :: ReadS [Prefix] Source # readPrec :: ReadPrec Prefix Source # readListPrec :: ReadPrec [Prefix] Source #
Show Prefix Source # |
Instance details Defined in Network.IRC.Base Methods showsPrec :: Int -> Prefix -> ShowS Source # show :: Prefix -> String Source # showList :: [Prefix] -> ShowS 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 # |
Instance details Defined in Network.IRC.Base Methods (==) :: Message -> Message -> Bool Source # (/=) :: Message -> Message -> Bool Source #
Read Message Source # |
Instance details Defined in Network.IRC.Base Methods readsPrec :: Int -> ReadS Message Source # readList :: ReadS [Message] Source # readPrec :: ReadPrec Message Source # readListPrec :: ReadPrec [Message] Source #
Show Message Source # |
Instance details Defined in Network.IRC.Base Methods showsPrec :: Int -> Message -> ShowS Source # show :: Message -> String Source # showList :: [Message] -> ShowS 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