summaryrefslogtreecommitdiff
path: root/Hsbot/IRC.hs
diff options
context:
space:
mode:
authorJulien Dessaux2010-02-04 20:55:54 +0100
committerJulien Dessaux2010-02-04 20:55:54 +0100
commit53870767c32f61f756861d7bf18b5a55cd45a2e2 (patch)
tree2cb6b79ecaa039f472a220b26ce2af44d52b488c /Hsbot/IRC.hs
parentImplemented unregisterCommand. (diff)
downloadhsbot-53870767c32f61f756861d7bf18b5a55cd45a2e2.tar.gz
hsbot-53870767c32f61f756861d7bf18b5a55cd45a2e2.tar.bz2
hsbot-53870767c32f61f756861d7bf18b5a55cd45a2e2.zip
Rewrote command handling, added the Quote module and cleaned input handling.
Diffstat (limited to '')
-rw-r--r--Hsbot/IRC.hs13
1 files changed, 3 insertions, 10 deletions
diff --git a/Hsbot/IRC.hs b/Hsbot/IRC.hs
index c10467e..a489ee9 100644
--- a/Hsbot/IRC.hs
+++ b/Hsbot/IRC.hs
@@ -5,11 +5,9 @@ module Hsbot.IRC
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
import Hsbot.Utils
@@ -27,17 +25,12 @@ initServer = do
runServer :: IrcBot ()
runServer = do
chan <- gets botChannel
- plugins <- gets botPlugins
let input = readChan chan
msg <- liftIO input
case msg of
- InputMsg inputMsg -> do
- dispatchCommand $ InputMsg inputMsg
- mapM_ (sendToPlugin (InputMsg inputMsg) . snd) (M.toList plugins)
- OutputMsg outputMsg ->
- sendstr (serializeIrcMsg outputMsg)
- InternalCmd _ ->
- traceM "TODO internal command"
+ InputMsg inputMsg -> dispatchMessage $ InputMsg inputMsg
+ OutputMsg outputMsg -> sendstr (serializeIrcMsg outputMsg)
+ InternalCmd internalCmd -> processInternalCommand $ InternalCmd internalCmd
runServer
-- | Joins a chan