Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
This module provides a parser and printer for the low-level IRC message format.
- data UserInfo = UserInfo {}
- data RawIrcMsg = RawIrcMsg {
- msgTime :: Maybe UTCTime
- msgPrefix :: Maybe UserInfo
- msgCommand :: ByteString
- msgParams :: [ByteString]
- parseRawIrcMsg :: ByteString -> Maybe RawIrcMsg
- renderRawIrcMsg :: RawIrcMsg -> ByteString
- parseUserInfo :: ByteString -> UserInfo
- renderUserInfo :: UserInfo -> ByteString
- data Identifier
- mkId :: ByteString -> Identifier
- idBytes :: Identifier -> ByteString
- idDenote :: Identifier -> ByteString
- asUtf8 :: ByteString -> Text
- ircFoldCase :: ByteString -> ByteString
Documentation
UserInfo
packages a nickname along with the username and hsotname
if they are known in the current context.
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
RawIrcMsg | |
|
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
data Identifier Source #
Case insensitive identifier representing channels and nicknames
mkId :: ByteString -> Identifier Source #
Construct an Identifier
from a ByteString
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.
asUtf8 :: ByteString -> Text Source #
ircFoldCase :: ByteString -> ByteString Source #
Capitalize a string according to RFC 2812 Latin letters are capitalized and {|}~ are mapped to []^