diff options
| author | pb <pb@9f8f72e9-4bf4-416e-b76e-7d4203597157> | 2010-03-16 20:56:57 +0000 |
|---|---|---|
| committer | pb <pb@9f8f72e9-4bf4-416e-b76e-7d4203597157> | 2010-03-16 20:56:57 +0000 |
| commit | df5f62ab71f56722bdeca8e77c78ab1d7aeeeb24 (patch) | |
| tree | bf61bdf59577ba93e77fbbfb22c7db65951ed7da /IRC.hs | |
| parent | e439488acb7e8a71703f8cb3d4e70340652359d3 (diff) | |
git-svn-id: https://ssl.buetow.org/repos/hsbot/trunk@34 9f8f72e9-4bf4-416e-b76e-7d4203597157
Diffstat (limited to 'IRC.hs')
| -rw-r--r-- | IRC.hs | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -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 (EnvWoDispatch state conf) s = do +ircPrivMsg h msg (Env state conf) s = do if isMultiline s then ircPrivMsg' (lines s) else ircPrivMsg' [s] @@ -52,7 +52,7 @@ ircPrivMsg h msg (EnvWoDispatch state conf) s = do ircPrivMsg' xs ircConnect :: Env -> IO () -ircConnect (Env state conf dispatch) = do +ircConnect (DispatchEnv state conf dispatch) = do ircChannel <- get "ircChannel" conf ircNick <- get "ircNick" conf ircPort <- get "ircPort" conf @@ -62,7 +62,7 @@ ircConnect (Env state conf dispatch) = do hSetBuffering h NoBuffering ircWrite h "NICK" ircNick ircWrite h "USER" $ ircNick ++ " 0 * :" ++ ircUser - ircEvalLoop h (Env state { currentChannel = ircChannel } conf dispatch) + ircEvalLoop h (DispatchEnv state { currentChannel = ircChannel } conf dispatch) ircEvalLoop :: Handle -> Env -> IO () ircEvalLoop h env = forever $ do @@ -85,12 +85,12 @@ ircEvalLoop h env = forever $ do pong x = ircWrite h "PONG" (':' : drop 6 x) ircEval :: Handle -> IrcMessage -> Env -> IO () -ircEval h msg env@(Env state conf dispatch) = +ircEval h msg env@(DispatchEnv state conf dispatch) = case isCommand (clean msg) of Just cmd -> dispatch cmd sendReplyMsg envWoDispatch Nothing -> evalServerMessage (clean msg) where - envWoDispatch = (EnvWoDispatch state conf) + envWoDispatch = (Env state conf) isCommand ('!':xs) = Just xs isCommand _ = Nothing evalServerMessage "+x" = ircWrite h "JOIN" (currentChannel state) |
