summaryrefslogtreecommitdiff
path: root/Plugins/Ping.hs
diff options
context:
space:
mode:
authorJulien Dessaux2010-02-04 20:36:58 +0100
committerJulien Dessaux2010-02-04 20:36:58 +0100
commit884c6c9f2e3a03d6666c8dd6c6d6b6513db88ad5 (patch)
treec5941649d7fe1ac23d5ee673c240efb8508b3db2 /Plugins/Ping.hs
parentRewrote the whole architecture. (diff)
downloadhsbot-884c6c9f2e3a03d6666c8dd6c6d6b6513db88ad5.tar.gz
hsbot-884c6c9f2e3a03d6666c8dd6c6d6b6513db88ad5.tar.bz2
hsbot-884c6c9f2e3a03d6666c8dd6c6d6b6513db88ad5.zip
Reorganized code and types, changed slightly the architecture.
Diffstat (limited to '')
-rw-r--r--Plugins/Ping.hs22
1 files changed, 22 insertions, 0 deletions
diff --git a/Plugins/Ping.hs b/Plugins/Ping.hs
new file mode 100644
index 0000000..46351aa
--- /dev/null
+++ b/Plugins/Ping.hs
@@ -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 ()
+