From cab8480d91d538fd3651ed1c546656b0fcd90e26 Mon Sep 17 00:00:00 2001 From: Philipp Balzarek Date: Sun, 10 Nov 2013 17:29:33 +0100 Subject: [PATCH] fix some documentation mistakes --- source/Network/Xmpp.hs | 4 ++-- source/Network/Xmpp/IM/Message.hs | 9 +++++---- source/Network/Xmpp/Lens.hs | 6 +++++- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/source/Network/Xmpp.hs b/source/Network/Xmpp.hs index a995a20..4c47c85 100644 --- a/source/Network/Xmpp.hs +++ b/source/Network/Xmpp.hs @@ -100,7 +100,7 @@ module Network.Xmpp -- | The /message/ stanza is a /push/ mechanism whereby one entity -- pushes information to another entity, similar to the communications that -- occur in a system such as email. It is not to be confused with - -- /instant messaging/ which is handled in the 'Network.Xmpp.IM' module + -- an 'InstantMessage' , Message(..) , message , MessageError(..) @@ -200,4 +200,4 @@ import Network.Xmpp.Sasl.Types import Network.Xmpp.Stanza import Network.Xmpp.Types import Network.Xmpp.Tls -import Network.Xmpp.Lens hiding (view, show, modify) +import Network.Xmpp.Lens hiding (view, set, modify) diff --git a/source/Network/Xmpp/IM/Message.hs b/source/Network/Xmpp/IM/Message.hs index 439a5c5..cdd2c32 100644 --- a/source/Network/Xmpp/IM/Message.hs +++ b/source/Network/Xmpp/IM/Message.hs @@ -30,6 +30,7 @@ data InstantMessage = InstantMessage { imThread :: Maybe MessageThread , imBody :: [MessageBody] } +-- | Empty instant message instantMessage :: InstantMessage instantMessage = InstantMessage { imThread = Nothing , imSubject = [] @@ -47,7 +48,8 @@ getIM im = either (const Nothing) Just . unpickle xpIM $ messagePayload im sanitizeIM :: InstantMessage -> InstantMessage sanitizeIM im = im{imBody = nubBy ((==) `on` bodyLang) $ imBody im} --- | Append IM data to a message. Additional IM bodies with the same Langtag +-- | Append IM data to a message. Additional IM bodies with the same Langtag are +-- discarded withIM :: Message -> InstantMessage -> Message withIM m im = m{ messagePayload = messagePayload m ++ pickleTree xpIM (sanitizeIM im) } @@ -65,10 +67,9 @@ simpleIM to bd = withIM message{messageTo = Just to} -- | 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. +-- thread are inherited. -- --- If multiple message bodies are given they MUST have different language tags +-- Additional IM bodies with the same Langtag are discarded answerIM :: [MessageBody] -> Message -> Maybe Message answerIM bd msg = case getIM msg of Nothing -> Nothing diff --git a/source/Network/Xmpp/Lens.hs b/source/Network/Xmpp/Lens.hs index fc042d8..d765626 100644 --- a/source/Network/Xmpp/Lens.hs +++ b/source/Network/Xmpp/Lens.hs @@ -73,16 +73,20 @@ module Network.Xmpp.Lens , queryVerL , queryItemsL -- ** IM Message + -- *** 'MessageBody' , bodyLangL , bodyContentL + -- *** 'MessageThread' , threadIdL , threadParentL + -- *** 'MessageSubject' , subjectLangL , subjectContentL + -- *** 'InstantMessage' , imThreadL , imSubjectL , imBodyL - -- IM Presence + -- ** 'IMPresence' , showStatusL , statusL , priorityL