summaryrefslogtreecommitdiff
path: root/Hsbot/Irc/Core.hs
diff options
context:
space:
mode:
authorJulien Dessaux2010-05-16 17:58:38 +0200
committerJulien Dessaux2010-05-16 17:58:38 +0200
commit738ad9e9bbbefb43a7889a458ff1c326a324eb9a (patch)
treef8337cc73ffdfa6956dc9425a8338fe496eafec7 /Hsbot/Irc/Core.hs
parentRewrote nearly everything! (diff)
downloadhsbot-738ad9e9bbbefb43a7889a458ff1c326a324eb9a.tar.gz
hsbot-738ad9e9bbbefb43a7889a458ff1c326a324eb9a.tar.bz2
hsbot-738ad9e9bbbefb43a7889a458ff1c326a324eb9a.zip
Removed thread ids from plugins data structure.
Diffstat (limited to 'Hsbot/Irc/Core.hs')
-rw-r--r--Hsbot/Irc/Core.hs13
1 files changed, 8 insertions, 5 deletions
diff --git a/Hsbot/Irc/Core.hs b/Hsbot/Irc/Core.hs
index ac51419..2c455ce 100644
--- a/Hsbot/Irc/Core.hs
+++ b/Hsbot/Irc/Core.hs
@@ -1,5 +1,5 @@
module Hsbot.Irc.Core
- ( ircbot
+ ( startIrcbot
) where
import Control.Concurrent
@@ -21,8 +21,8 @@ import Hsbot.Irc.Types
import Hsbot.Message (BotMsg)
-- | IrcBot's main entry point
-ircbot :: IrcConfig -> Chan BotMsg -> Chan BotMsg -> IO ()
-ircbot config masterChan myChan = do
+startIrcbot :: IrcConfig -> Chan BotMsg -> Chan BotMsg -> IO ()
+startIrcbot config masterChan myChan = do
startTime <- getCurrentTime
putStrLn "[IrcBot] Opening communication channel... "
chan <- newChan :: IO (Chan IrcBotMsg)
@@ -55,6 +55,9 @@ ircbot config masterChan myChan = do
_ <- ircBotLoop ircBotState' `catch` (\(_ :: IOException) -> return ())
return ()
+--resumeIrcBot
+--resumeIrcBot
+
-- | Runs the IrcBot's reader loop
ircBotReader :: Handle -> Chan IrcBotMsg -> ThreadId -> IO ()
ircBotReader handle chan fatherThreadId = forever $ do
@@ -126,9 +129,9 @@ dispatchMessage (InIrcMsg inIrcMsg) = do
let key = tail . head $ words getMsgContent
pluginNames = fromMaybe [] $ M.lookup key cmds
plugins' = fromMaybe [] $ mapM (flip M.lookup plugins) pluginNames
- in mapM_ (sendRunCommand $ tail getMsgContent) plugins'
+ in mapM_ (sendRunCommand (tail getMsgContent) . fst) plugins'
else
- mapM_ (sendToPlugin $ InIrcMsg inIrcMsg) (M.elems plugins)
+ mapM_ (sendToPlugin (InIrcMsg inIrcMsg) . fst) (M.elems plugins)
where
isPluginCommand :: IrcConfig -> Bool
isPluginCommand config =