irc-core-2.7.0: IRC core library for glirc

Copyright(c) Eric Mertens 2016
LicenseISC
Maintaineremertens@gmail.com
Safe HaskellNone
LanguageHaskell2010

Irc.RawIrcMsg

Contents

Description

This module provides a parser and printer for the low-level IRC message format. It handles splitting up IRC commands into the prefix, command, and arguments.

Synopsis

Low-level IRC messages

data RawIrcMsg Source #

RawIrcMsg breaks down the IRC protocol into its most basic parts. The "trailing" parameter indicated in the IRC protocol with a leading colon will appear as the last parameter in the parameter list.

Note that RFC 2812 specifies a maximum of 15 parameters.

This parser is permissive regarding spaces. It aims to parse carefully constructed messages exactly and to make a best effort to recover from extraneous spaces. It makes no effort to validate nicknames, usernames, hostnames, commands, etc. Servers don't all agree on these things.

:prefix COMMAND param0 param1 param2 .. paramN

Constructors

RawIrcMsg 

Fields

Instances
Eq RawIrcMsg Source # 
Instance details

Defined in Irc.RawIrcMsg

Read RawIrcMsg Source # 
Instance details

Defined in Irc.RawIrcMsg

Show RawIrcMsg Source # 
Instance details

Defined in Irc.RawIrcMsg

data TagEntry Source #

Key value pair representing an IRCv3.2 message tag. The value in this pair has had the message tag unescape algorithm applied.

Constructors

TagEntry !Text !Text 
Instances
Eq TagEntry Source # 
Instance details

Defined in Irc.RawIrcMsg

Read TagEntry Source # 
Instance details

Defined in Irc.RawIrcMsg

Show TagEntry Source # 
Instance details

Defined in Irc.RawIrcMsg

rawIrcMsg Source #

Arguments

:: Text

command

-> [Text]

parameters

-> RawIrcMsg 

Construct a new RawIrcMsg without a time or prefix.

msgTags :: Functor f => ([TagEntry] -> f [TagEntry]) -> RawIrcMsg -> f RawIrcMsg Source #

Lens for _msgTags

msgParams :: Functor f => ([Text] -> f [Text]) -> RawIrcMsg -> f RawIrcMsg Source #

Lens for _msgParams

Text format for IRC messages

parseRawIrcMsg :: Text -> Maybe RawIrcMsg Source #

Attempt to split an IRC protocol message without its trailing newline information into a structured message.

renderRawIrcMsg :: RawIrcMsg -> ByteString Source #

Serialize a structured IRC protocol message back into its wire format. This command adds the required trailing newline.

prefixParser :: Parser UserInfo Source #

Parse a rendered UserInfo token.

simpleTokenParser :: Parser Text Source #

Take the next space-delimited lexeme

Permissive text decoder

asUtf8 :: ByteString -> Text Source #

Try to decode a message as UTF-8. If that fails interpret it as Windows CP1252 This helps deal with clients like XChat that get clever and otherwise misconfigured clients.