diff options
author | Julien Dessaux | 2009-08-07 00:19:14 +0200 |
---|---|---|
committer | Julien Dessaux | 2009-08-07 00:19:14 +0200 |
commit | 14f87adb8b3cfc019b7de7f082e3851a91b6a364 (patch) | |
tree | 6860704ec357ebcba4518cfd354a880907073800 /Hsbot/Main.hs | |
parent | Refactored some minor stuff (diff) | |
download | hsbot-14f87adb8b3cfc019b7de7f082e3851a91b6a364.tar.gz hsbot-14f87adb8b3cfc019b7de7f082e3851a91b6a364.tar.bz2 hsbot-14f87adb8b3cfc019b7de7f082e3851a91b6a364.zip |
Wrote the ping pong stuff
Diffstat (limited to '')
-rw-r--r-- | Hsbot/Main.hs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Hsbot/Main.hs b/Hsbot/Main.hs index 23b3991..dad568a 100644 --- a/Hsbot/Main.hs +++ b/Hsbot/Main.hs @@ -2,6 +2,9 @@ module Hsbot.Main ( imain ) where +import Control.Concurrent +import Control.Concurrent.Chan +import Control.Monad import System.IO import System.Plugins @@ -18,9 +21,18 @@ imain modul' reboot = imain' modul' reboot newbot -- | Bot's main entry point imain' :: Module -> Reboot -> Bot -> IO () imain' modul' reboot bot = do + putStrLn "yeah" putStrLn "Connecting servers..." servers' <- mapM connectServer (ircServers C.config) putStrLn "Joining channels..." mapM_ initServer servers' return () +-- | Thread entry point for socket listeners +listener :: (Chan IrcOutput) -> (IrcServer, Handle) -> IO () +listener chan (server, handle) = forever $ do + str <- hGetLine handle + writeChan chan (Str str) + if ping str then pong handle str + else return () + |