Archived
1
0
Fork 0

Wrote the ping pong stuff

This commit is contained in:
Julien Dessaux 2009-08-07 00:19:14 +02:00
parent 2f270f8bdf
commit 14f87adb8b
3 changed files with 28 additions and 2 deletions

View file

@ -4,9 +4,12 @@ module Hsbot.IRC
, connectServer
, initServer
, parseIrcMsg
, ping
, pong
)where
import Control.Monad
import Data.List(isPrefixOf)
import Network
import qualified Network.IRC as IRC
import System.IO
@ -56,3 +59,11 @@ initServer (server, handle) = do
mapM_ (sendstr handle . IRC.encode . IRC.joinChan) (channels server)
return ()
-- | Check if a message is a PING
ping :: String -> Bool
ping = isPrefixOf "PING :"
-- | Send a pong message given a ping message
pong :: Handle -> String -> IO ()
pong handle str = sendstr handle $ "PONG " ++ (drop 5 str)