X-Git-Url: https://git.martlubbers.net/?p=cloogle-irc.git;a=blobdiff_plain;f=IRC.dcl;h=afb7a747682257173be7cdacc06560f6b5f7238d;hp=d476d725e16f97288fe5bbead7dfc28345aad898;hb=f828f3a79cfcfb21c6c7a7773905cc210a739f75;hpb=87d709d61dae99cc468f52927e8246b3b6bc9022 diff --git a/IRC.dcl b/IRC.dcl index d476d72..afb7a74 100644 --- a/IRC.dcl +++ b/IRC.dcl @@ -1,7 +1,22 @@ definition module IRC from Data.Maybe import :: Maybe -from StdOverloaded import class fromInt, class toInt, class toString +from Data.Either import :: Either +from StdOverloaded import class fromInt, class toInt, class toString, class fromString + +:: IRCMessage = + { irc_prefix :: Maybe (Either String IRCUser) + , irc_command :: IRCCommands} + +:: IRCUser = + { irc_nick :: String + , irc_user :: Maybe String + , irc_host :: Maybe String + } + +instance toString IRCCommands, IRCReplies, IRCErrors, IRCMessage, IRCUser +instance fromInt IRCReplies, IRCErrors +instance toInt IRCReplies, IRCErrors :: IRCCommands = ADMIN (Maybe String) @@ -23,18 +38,18 @@ from StdOverloaded import class fromInt, class toInt, class toString | NAMES [String] | NICK String | NJOIN - | NOTICE + | NOTICE String String | OPER String String | PART [String] | PASS String - | PING [String] - | PONG [String] + | PING String (Maybe String) + | PONG String (Maybe String) | PRIVMSG String String - | QUIT String + | QUIT (Maybe String) | REHASH | RESTART | SERVER - | SERVICE + | SERVICE String String String String | SERVLIST (Maybe (String, Maybe String)) | SQUERY String String | SQUIRT @@ -44,11 +59,11 @@ from StdOverloaded import class fromInt, class toInt, class toString | TIME (Maybe String) | TOPIC String (Maybe String) | TRACE (Maybe String) - | USER String String String + | USER String Int String | USERHOST [String] | USERS (Maybe String) | VERSION (Maybe String) - | WALLOPS + | WALLOPS String | WHO (Maybe String) | WHOIS (Maybe String) [String] | WHOWAS (Maybe String) [String] @@ -90,7 +105,3 @@ from StdOverloaded import class fromInt, class toInt, class toString ERR_NOPRIVILEGES | ERR_CHANOPRIVSNEEDED | ERR_CANTKILLSERVER | ERR_RESTRICTED | ERR_UNIQOPPRIVSNEEDED | ERR_NOOPERHOST | ERR_UMODEUNKNOWNFLAG | ERR_USERSDONTMATCH - -instance toString IRCCommands, IRCReplies, IRCErrors -instance fromInt IRCReplies, IRCErrors -instance toInt IRCReplies, IRCErrors