summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Dessaux2011-05-13 18:10:55 +0200
committerJulien Dessaux2011-05-13 18:10:55 +0200
commit81fb522dd4fcf9b7b8714a2f69a4ba7513120ea4 (patch)
treecd908b20c26ed3c7d88aed23b066417b96ea7ab1
parentRe-engineered and finished the duck spawning capability. (diff)
downloadhsbot-81fb522dd4fcf9b7b8714a2f69a4ba7513120ea4.tar.gz
hsbot-81fb522dd4fcf9b7b8714a2f69a4ba7513120ea4.tar.bz2
hsbot-81fb522dd4fcf9b7b8714a2f69a4ba7513120ea4.zip
Added a function to get the sender of an irc message.
Diffstat (limited to '')
-rw-r--r--Hsbot/Message.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/Hsbot/Message.hs b/Hsbot/Message.hs
index 9bb77f1..14488a1 100644
--- a/Hsbot/Message.hs
+++ b/Hsbot/Message.hs
@@ -2,6 +2,7 @@ module Hsbot.Message
( answerMsg
, getCommand
, getDestination
+ , getSender
, readMsg
, writeMsg
) where
@@ -37,6 +38,10 @@ getCommand (IRC.Message _ _ (_:msg:[])) = do
else return []
getCommand _ = return []
+getSender :: IRC.Message -> String
+getSender (IRC.Message (Just (IRC.NickName nick _ _)) _ _) = nick
+getSender _ = ""
+
-- | Get the destination of a message
getDestination :: IRC.Message -> String
getDestination (IRC.Message _ _ (dest:_:[])) = dest