Archived
1
0
Fork 0

Added a function to get the sender of an irc message.

This commit is contained in:
Julien Dessaux 2011-05-13 18:10:55 +02:00
parent a6ac073a6c
commit 81fb522dd4

View file

@ -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