From 884c6c9f2e3a03d6666c8dd6c6d6b6513db88ad5 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Thu, 4 Feb 2010 20:36:58 +0100 Subject: Reorganized code and types, changed slightly the architecture. --- Plugins/Ping.hs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Plugins/Ping.hs (limited to 'Plugins') 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 () + -- cgit v1.2.3