From e58cd11b2578be35a00a4e045ac91d2aed0207bd Mon Sep 17 00:00:00 2001 From: Philipp Balzarek Date: Thu, 10 May 2012 16:18:01 +0200 Subject: [PATCH] Add Network.XMPP.IM.Message documentation --- src/Network/XMPP/IM/Message.hs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Network/XMPP/IM/Message.hs b/src/Network/XMPP/IM/Message.hs index fbf3819..5710c83 100644 --- a/src/Network/XMPP/IM/Message.hs +++ b/src/Network/XMPP/IM/Message.hs @@ -47,7 +47,10 @@ subject m = ms -- xpFindMatches will _always_ return Right Right ms = unpickle (xpFindMatches xpMessageSubject) $ messagePayload m --- | Get the thread elements of a message (if any). The threads is not considered human readable and no semantic mea +-- | Get the thread elements of a message (if any). The thread of a +-- message is considered opaque, that is, no meaning, other than it's +-- literal identity, may be derived from it and it is not human +-- readable thread :: Message -> Maybe MessageThread thread m = ms where @@ -62,6 +65,7 @@ body m = ms -- xpFindMatches will _always_ return Right Right ms = unpickle (xpFindMatches xpMessageBody) $ messagePayload m +-- | Generate a new instant message newIM :: JID -> Maybe StanzaId @@ -85,7 +89,7 @@ newIM t i lang tp sbj thrd bdy payload = Message ++ [payload] } - +-- | Generate a simple instance message simpleIM :: JID -> Text -> Message simpleIM t bd = newIM t @@ -97,6 +101,11 @@ simpleIM t bd = newIM (Just $ MessageBody Nothing bd) [] +-- | Generate an answer from a received message. The recepient is +-- taken from the original sender, the sender is set to Nothing, +-- message ID, language tag, message type as well as subject and +-- thread are inherited, the remaining payload is replaced by the +-- given one answerIM :: Maybe MessageBody -> [Element] -> Message -> Message answerIM bd payload msg = Message { messageID = messageID msg