summaryrefslogtreecommitdiff
path: root/IRC.hs
diff options
context:
space:
mode:
authorpb <pb@9f8f72e9-4bf4-416e-b76e-7d4203597157>2010-03-14 14:24:49 +0000
committerpb <pb@9f8f72e9-4bf4-416e-b76e-7d4203597157>2010-03-14 14:24:49 +0000
commit17c092a07ad03bbb77bcf629463f78b5a49dc4cb (patch)
tree6319b417bef98e4c474af2d38933b284c42d360d /IRC.hs
parenta7865fd10582a9b710e96d2052a9ce90ced8020c (diff)
git-svn-id: https://ssl.buetow.org/repos/hsbot/trunk@27 9f8f72e9-4bf4-416e-b76e-7d4203597157
Diffstat (limited to 'IRC.hs')
-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