started with parsing
[cloogle-irc.git] / IRC.dcl
diff --git a/IRC.dcl b/IRC.dcl
index d476d72..afb7a74 100644 (file)
--- 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