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
-- | The /message/ stanza is a /push/ mechanism whereby one entity -- | The /message/ stanza is a /push/ mechanism whereby one entity
-- pushes information to another entity, similar to the communications that -- pushes information to another entity, similar to the communications that
-- occur in a system such as email. It is not to be confused with -- 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(..)
, message , message
, MessageError(..) , MessageError(..)
@ -200,4 +200,4 @@ import Network.Xmpp.Sasl.Types
import Network.Xmpp.Stanza import Network.Xmpp.Stanza
import Network.Xmpp.Types import Network.Xmpp.Types
import Network.Xmpp.Tls 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
, imBody :: [MessageBody] , imBody :: [MessageBody]
} }
-- | Empty instant message
instantMessage :: InstantMessage instantMessage :: InstantMessage
instantMessage = InstantMessage { imThread = Nothing instantMessage = InstantMessage { imThread = Nothing
, imSubject = [] , imSubject = []
@ -47,7 +48,8 @@ getIM im = either (const Nothing) Just . unpickle xpIM $ messagePayload im
sanitizeIM :: InstantMessage -> InstantMessage sanitizeIM :: InstantMessage -> InstantMessage
sanitizeIM im = im{imBody = nubBy ((==) `on` bodyLang) $ imBody im} 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 :: Message -> InstantMessage -> Message
withIM m im = m{ messagePayload = messagePayload m withIM m im = m{ messagePayload = messagePayload m
++ pickleTree xpIM (sanitizeIM im) } ++ 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 -- | Generate an answer from a received message. The recepient is
-- taken from the original sender, the sender is set to Nothing, -- taken from the original sender, the sender is set to Nothing,
-- message ID, language tag, message type as well as subject and -- message ID, language tag, message type as well as subject and
-- thread are inherited, the remaining payload is replaced by the -- thread are inherited.
-- given one.
-- --
-- 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 :: [MessageBody] -> Message -> Maybe Message
answerIM bd msg = case getIM msg of answerIM bd msg = case getIM msg of
Nothing -> Nothing Nothing -> Nothing

6
source/Network/Xmpp/Lens.hs

@ -73,16 +73,20 @@ module Network.Xmpp.Lens
, queryVerL , queryVerL
, queryItemsL , queryItemsL
-- ** IM Message -- ** IM Message
-- *** 'MessageBody'
, bodyLangL , bodyLangL
, bodyContentL , bodyContentL
-- *** 'MessageThread'
, threadIdL , threadIdL
, threadParentL , threadParentL
-- *** 'MessageSubject'
, subjectLangL , subjectLangL
, subjectContentL , subjectContentL
-- *** 'InstantMessage'
, imThreadL , imThreadL
, imSubjectL , imSubjectL
, imBodyL , imBodyL
-- IM Presence -- ** 'IMPresence'
, showStatusL , showStatusL
, statusL , statusL
, priorityL , priorityL

Loading…
Cancel
Save