From cf68de02be3e9695c95b0d1fafdab5ab2c0fc5f7 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Thu, 4 Feb 2010 20:40:16 +0100 Subject: Added command registering and dispatching for plugins. --- Hsbot/IRC.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'Hsbot/IRC.hs') 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 -- cgit v1.2.3