From 81fb522dd4fcf9b7b8714a2f69a4ba7513120ea4 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Fri, 13 May 2011 18:10:55 +0200 Subject: Added a function to get the sender of an irc message. --- Hsbot/Message.hs | 5 +++++ 1 file changed, 5 insertions(+) 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 -- cgit v1.2.3