summaryrefslogtreecommitdiff
path: root/Hsbot/IRC.hs
diff options
context:
space:
mode:
authorJulien Dessaux2010-02-04 20:40:16 +0100
committerJulien Dessaux2010-02-04 20:40:16 +0100
commitcf68de02be3e9695c95b0d1fafdab5ab2c0fc5f7 (patch)
tree977286771d0f9e126ae599af01a63e06b3c67d2d /Hsbot/IRC.hs
parentFinished changing plugin data structure to Maps. (diff)
downloadhsbot-cf68de02be3e9695c95b0d1fafdab5ab2c0fc5f7.tar.gz
hsbot-cf68de02be3e9695c95b0d1fafdab5ab2c0fc5f7.tar.bz2
hsbot-cf68de02be3e9695c95b0d1fafdab5ab2c0fc5f7.zip
Added command registering and dispatching for plugins.
Diffstat (limited to '')
-rw-r--r--Hsbot/IRC.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/Hsbot/IRC.hs b/Hsbot/IRC.hs
index a8f3fcb..c10467e 100644
--- a/Hsbot/IRC.hs
+++ b/Hsbot/IRC.hs
@@ -7,6 +7,7 @@ import Control.Concurrent.Chan
import Control.Monad.State
import qualified Data.Map as M
+import Hsbot.Command
import Hsbot.IRCParser
import Hsbot.Plugin
import Hsbot.Types
@@ -30,12 +31,13 @@ runServer = do
let input = readChan chan
msg <- liftIO input
case msg of
- InputMsg inputMsg ->
+ InputMsg inputMsg -> do
+ dispatchCommand $ InputMsg inputMsg
mapM_ (sendToPlugin (InputMsg inputMsg) . snd) (M.toList plugins)
OutputMsg outputMsg ->
sendstr (serializeIrcMsg outputMsg)
- InternalCmd internalCmd ->
- traceM "TODO"
+ InternalCmd _ ->
+ traceM "TODO internal command"
runServer
-- | Joins a chan