summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
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