Browse Source

fix some documentation mistakes

master
Philipp Balzarek 12 years ago
parent
commit
cab8480d91
  1. 4
      source/Network/Xmpp.hs
  2. 9
      source/Network/Xmpp/IM/Message.hs
  3. 6
      source/Network/Xmpp/Lens.hs

4
source/Network/Xmpp.hs

@ -100,7 +100,7 @@ module Network.Xmpp @@ -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 @@ -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)

9
source/Network/Xmpp/IM/Message.hs

@ -30,6 +30,7 @@ data InstantMessage = InstantMessage { imThread :: Maybe MessageThread @@ -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 @@ -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} @@ -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

6
source/Network/Xmpp/Lens.hs

@ -73,16 +73,20 @@ module Network.Xmpp.Lens @@ -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

Loading…
Cancel
Save