summaryrefslogtreecommitdiff
path: root/Hsbot/Main.hs
diff options
context:
space:
mode:
authorJulien Dessaux2009-08-11 00:38:36 +0200
committerJulien Dessaux2009-08-11 00:38:36 +0200
commit7a86235906470749a7a6f88ff57c263cdeadde9a (patch)
treec5cba0eed5fa2a08f3efb7364898d9a0af014df5 /Hsbot/Main.hs
parentFixed my mess with the rfc doc stuff... :p (diff)
downloadhsbot-7a86235906470749a7a6f88ff57c263cdeadde9a.tar.gz
hsbot-7a86235906470749a7a6f88ff57c263cdeadde9a.tar.bz2
hsbot-7a86235906470749a7a6f88ff57c263cdeadde9a.zip
Rethought the way I handled IRC data.
Diffstat (limited to 'Hsbot/Main.hs')
-rw-r--r--Hsbot/Main.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/Hsbot/Main.hs b/Hsbot/Main.hs
index 3ced3a5..9edd807 100644
--- a/Hsbot/Main.hs
+++ b/Hsbot/Main.hs
@@ -28,13 +28,13 @@ imain' modul' reboot bot = do
putStrLn "Joining channels..."
mapM_ initServer servers'
putStrLn "Spawning threads..."
- chan <- newChan :: IO (Chan IrcOutput)
+ chan <- newChan :: IO (Chan IrcLine)
mapM_ (forkIO . listener chan) servers'
state <- monitor chan bot
reboot modul' bot
-- | Bot main loop, monitors the threads states and handle reboot
-monitor :: (Chan IrcOutput) -> Bot -> IO Bot
+monitor :: (Chan IrcLine) -> Bot -> IO Bot
monitor chan bot = do
loop bot
where loop bot' = do
@@ -46,7 +46,7 @@ monitor chan bot = do
Str str -> putStrLn ("received : " ++ str) >> loop bot'
-- | Thread entry point for socket listeners
-listener :: (Chan IrcOutput) -> (IrcServer, Handle) -> IO ()
+listener :: (Chan IrcLine) -> (IrcServer, Handle) -> IO ()
listener chan (server, handle) = forever $ do
str <- hGetLine handle
writeChan chan (Str str)