irc-core-1.1.3: An IRC client library and text client

Safe HaskellSafe



This module provides a parser and printer for the low-level IRC message format.



data UserInfo Source

UserInfo packages a nickname along with the username and hsotname if they are known in the current context.

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.

:prefix COMMAND param0 param1 param2 .. paramN

parseRawIrcMsg :: ByteString -> 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.

parseUserInfo :: ByteString -> UserInfo Source

Split up a hostmask into a nickname, username, and hostname. The username and hostname might not be defined but are delimited by a ! and @ respectively.

renderUserInfo :: UserInfo -> ByteString Source

Take the bytes up to the next space delimiter. If the first character of this token is a : then take the whole remaining bytestring

Render UserInfo as nick!username@hostname

idBytes :: Identifier -> ByteString Source

Returns the original ByteString of an Identifier

idDenote :: Identifier -> ByteString Source

Returns the case-normalized ByteString of an Identifier which is suitable for comparison.

ircFoldCase :: ByteString -> ByteString Source

Capitalize a string according to RFC 2812 Latin letters are capitalized and {|}~ are mapped to []^