summaryrefslogtreecommitdiff
path: root/Hsbot
diff options
context:
space:
mode:
authorJulien Dessaux2011-05-11 00:17:10 +0200
committerJulien Dessaux2011-05-11 00:17:10 +0200
commit27df2808fc4618699abf6b8b8fcd88de26615bb6 (patch)
tree5c0b5f60c5ecd020f7976cbf5328e42693f3bf56 /Hsbot
parentImproving a bit the Ping module's code. (diff)
downloadhsbot-27df2808fc4618699abf6b8b8fcd88de26615bb6.tar.gz
hsbot-27df2808fc4618699abf6b8b8fcd88de26615bb6.tar.bz2
hsbot-27df2808fc4618699abf6b8b8fcd88de26615bb6.zip
Added a function to get the destination channel of a message.
Diffstat (limited to 'Hsbot')
-rw-r--r--Hsbot/Message.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/Hsbot/Message.hs b/Hsbot/Message.hs
index dd15f75..9bb77f1 100644
--- a/Hsbot/Message.hs
+++ b/Hsbot/Message.hs
@@ -1,6 +1,7 @@
module Hsbot.Message
( answerMsg
, getCommand
+ , getDestination
, readMsg
, writeMsg
) where
@@ -36,3 +37,8 @@ getCommand (IRC.Message _ _ (_:msg:[])) = do
else return []
getCommand _ = return []
+-- | Get the destination of a message
+getDestination :: IRC.Message -> String
+getDestination (IRC.Message _ _ (dest:_:[])) = dest
+getDestination _ = ""
+