Archived
1
0
Fork 0

Added command registering and dispatching for plugins.

This commit is contained in:
Julien Dessaux 2010-02-04 20:40:16 +01:00
commit cf68de02be
6 changed files with 79 additions and 16 deletions
Hsbot

View file

@ -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