summaryrefslogtreecommitdiffstats
path: root/Hirc
diff options
context:
space:
mode:
authortv <tv@shackspace.de>2015-10-08 22:01:46 +0200
committertv <tv@shackspace.de>2015-10-08 22:03:31 +0200
commit4c74e39b922ff0d2dd572f90cee0cd842aa40a84 (patch)
tree38e323ba3c84750f4a83a88b4993cb50b9a3e365 /Hirc
parentc07b9562e72133ccf5a64e880beb53cb8499a642 (diff)
Evaluate parsed messages
Diffstat (limited to 'Hirc')
-rw-r--r--Hirc/Parser.hs4
-rw-r--r--Hirc/Types.hs12
2 files changed, 6 insertions, 10 deletions
diff --git a/Hirc/Parser.hs b/Hirc/Parser.hs
index 2cb2451..ef34270 100644
--- a/Hirc/Parser.hs
+++ b/Hirc/Parser.hs
@@ -7,7 +7,7 @@ import Text.Parsec.String
message :: Parser Message
message =
- Message <$> optionMaybe (char ':' *> prefix) <* spaces1 <*> command <*> params
+ Message <$> optionMaybe (char ':' *> prefix <* spaces1) <*> command <*> params
where
spaces1 = skipMany1 space
prefix = Prefix <$> nick
@@ -16,7 +16,7 @@ message =
nick = many1 (noneOf " !@")
user = many1 (noneOf " !@")
host = many1 (noneOf " !@")
- command = UnknownCommand <$> many1 nonspace
+ command = many1 nonspace
params = many1 (spaces1 *> (trailing <|> middle))
trailing = char ':' *> many1 anyChar
middle = many1 nonspace
diff --git a/Hirc/Types.hs b/Hirc/Types.hs
index 1bb258c..2567b53 100644
--- a/Hirc/Types.hs
+++ b/Hirc/Types.hs
@@ -1,5 +1,9 @@
module Hirc.Types where
+type Command = String
+type Param = String
+type Receiver = String
+
data Message =
Message {
m_prefix :: Maybe Prefix,
@@ -8,8 +12,6 @@ data Message =
}
deriving Show
-type Param = String
-
data Prefix =
Prefix {
p_name :: String,
@@ -18,9 +20,3 @@ data Prefix =
}
deriving Show
-data Command =
- PRIVMSG Receiver [Receiver] String |
- UnknownCommand String
- deriving Show
-
-type Receiver = String