Archived
1
0
Fork 0

Reorganized code and types, changed slightly the architecture.

This commit is contained in:
Julien Dessaux 2010-02-04 20:36:58 +01:00
parent 57f559f3a1
commit 884c6c9f2e
10 changed files with 272 additions and 164 deletions

22
Plugins/Ping.hs Normal file
View file

@ -0,0 +1,22 @@
module Plugins.Ping
( mainPing
) where
import Control.Concurrent.Chan
import Hsbot.Types
mainPing :: Chan BotMsg -> Chan BotMsg -> IO ()
mainPing serverChan chan = do
loop
where
loop = do
input <- readChan chan
eval input
loop
eval :: BotMsg -> IO ()
eval (InputMsg msg)
| (command msg) == "PING" = writeChan serverChan $ OutputMsg $ IrcMsg Nothing "PONG" (parameters msg)
| otherwise = return ()
eval _ = return ()