summaryrefslogtreecommitdiff
path: root/Hsbot
diff options
context:
space:
mode:
authorJulien Dessaux2011-08-09 23:48:15 +0200
committerJulien Dessaux2011-08-09 23:48:15 +0200
commit98a1debf03cd0b5145578f823b025d2315394503 (patch)
tree61eb8b705f396830ff637fb0dd1bfcdaf1b8583a /Hsbot
parentcosmetic (diff)
downloadhsbot-98a1debf03cd0b5145578f823b025d2315394503.tar.gz
hsbot-98a1debf03cd0b5145578f823b025d2315394503.tar.bz2
hsbot-98a1debf03cd0b5145578f823b025d2315394503.zip
Moved to death messages IRC output around, because those were sent too soon
Diffstat (limited to 'Hsbot')
-rw-r--r--Hsbot/Core.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/Hsbot/Core.hs b/Hsbot/Core.hs
index 49f5f5d..4dc1e92 100644
--- a/Hsbot/Core.hs
+++ b/Hsbot/Core.hs
@@ -53,8 +53,8 @@ initHsbot config = do
, envTLS = tls
, envTLSCtx = tlsCtx }
-runHsbot :: Env IO BotStatus
-runHsbot = do
+runHsbot :: [String] -> Env IO BotStatus
+runHsbot die_msgs = do
botNotInitialized <- asks envBotState >>= liftIO . isEmptyMVar
when botNotInitialized runFirstSteps
trueRunHsbot
@@ -74,6 +74,8 @@ runHsbot = do
liftIO . sendStr env connhdl tlsCtx . IRC.encode $ IRC.user nickname hostname "*" (configRealname config)
-- Then we join channels
mapM_ (liftIO . sendStr env connhdl tlsCtx . IRC.encode . IRC.joinChan) channels
+ -- We advertise any death message we should
+ mapM_ (\msg -> mapM_ (\channel -> liftIO . sendStr env connhdl tlsCtx . IRC.encode $ IRC.Message Nothing "PRIVMSG" [channel, msg]) channels) die_msgs
-- Finally we set the new bot state
asks envBotState >>= liftIO . flip putMVar BotState { botPlugins = M.empty
, botAccess = configAccess config