summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--IRC.hs32
1 files changed, 20 insertions, 12 deletions
diff --git a/IRC.hs b/IRC.hs
index 02f0a59..d1e4724 100644
--- a/IRC.hs
+++ b/IRC.hs
@@ -27,21 +27,29 @@ ircWrite h s t = do
ircPrivmsg :: Handle -> IrcMessage -> Env -> String -> IO ()
ircPrivmsg h msg (Env state conf) s = do
- if isMultiline s then ircPrivmsg' (lines s) else ircPrivmsg' [s]
+ if isMultiline s
+ then ircPrivmsg' (lines s)
+ else ircPrivmsg' [s]
where
ircPrivmsg' [] = return ()
ircPrivmsg' (x:xs) =
- let maxMessageSize = getUnwrappedInt "maxMessageSize" conf
- receiver = if (isQuery msg) then from msg else currentChannel state
+ let maxMessageSize =
+ getUnwrappedInt "maxMessageSize" conf
+ receiver =
+ if (isQuery msg)
+ then from msg
+ else currentChannel state
in if length x > maxMessageSize
- then do ircWrite h "PRIVMSG" (receiver ++ " :"
- ++ (take maxMessageSize x) ++ "...")
- ircWrite h "PRIVMSG" (receiver ++ " :"
- ++ "...this message has been cut to "
- ++ (show maxMessageSize) ++ " chars")
- ircPrivmsg' xs
- else do ircWrite h "PRIVMSG" (receiver ++ " :" ++ x)
- ircPrivmsg' xs
+ then do
+ ircWrite h "PRIVMSG" (receiver ++ " :"
+ ++ (take maxMessageSize x) ++ "...")
+ ircWrite h "PRIVMSG" (receiver ++ " :"
+ ++ "...this message has been cut to "
+ ++ (show maxMessageSize) ++ " chars")
+ ircPrivmsg' xs
+ else do
+ ircWrite h "PRIVMSG" (receiver ++ " :" ++ x)
+ ircPrivmsg' xs
ircConnect :: Env -> IO ()
ircConnect (Env state conf) = do
@@ -54,7 +62,7 @@ ircConnect (Env state conf) = do
hSetBuffering h NoBuffering
ircWrite h "NICK" ircNick
ircWrite h "USER" $ ircNick ++ " 0 * :" ++ ircUser
- ircEvalLoop h (Env (state { currentChannel = ircChannel }) conf)
+ ircEvalLoop h (Env state { currentChannel = ircChannel } conf)
ircEvalLoop :: Handle -> Env -> IO ()
ircEvalLoop h env = forever $ do