summaryrefslogtreecommitdiff
path: root/IRC.hs
diff options
context:
space:
mode:
Diffstat (limited to 'IRC.hs')
-rw-r--r--IRC.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/IRC.hs b/IRC.hs
index 4a402c7..fc32d9b 100644
--- a/IRC.hs
+++ b/IRC.hs
@@ -26,7 +26,7 @@ ircWrite h s t = do
hPrintf h "%s %s\r\n" s t
ircPrivMsg :: Handle -> IrcMessage -> Env -> String -> IO ()
-ircPrivMsg h msg (Env state conf _) s = do
+ircPrivMsg h msg (EnvWoDispatch state conf) s = do
if isMultiline s
then ircPrivMsg' (lines s)
else ircPrivMsg' [s]
@@ -85,13 +85,14 @@ ircEvalLoop h env = forever $ do
pong x = ircWrite h "PONG" (':' : drop 6 x)
ircEval :: Handle -> IrcMessage -> Env -> IO ()
-ircEval h msg env@(Env state _ dispatch) =
+ircEval h msg env@(Env state conf dispatch) =
case isCommand (clean msg) of
- Just cmd -> dispatch cmd sendReplyMsg env
+ Just cmd -> dispatch cmd sendReplyMsg envWoDispatch
Nothing -> evalServerMessage (clean msg)
where
+ envWoDispatch = (EnvWoDispatch state conf)
isCommand ('!':xs) = Just xs
isCommand _ = Nothing
evalServerMessage "+x" = ircWrite h "JOIN" (currentChannel state)
evalServerMessage _ = putStrLn $ show msg
- sendReplyMsg = ircPrivMsg h msg env
+ sendReplyMsg = ircPrivMsg h msg envWoDispatch