Browse Source

Apply minor Haddock changes

master
Jon Kristensen 12 years ago
parent
commit
2b1b1c8d00
  1. 2
      README.md
  2. 2
      source/Network/Xmpp/Concurrent/Monad.hs
  3. 8
      source/Network/Xmpp/IM/Message.hs
  4. 4
      source/Network/Xmpp/IM/Presence.hs
  5. 9
      source/Network/Xmpp/IM/Roster.hs
  6. 6
      source/Network/Xmpp/Types.hs

2
README.md

@ -94,7 +94,7 @@ is the same as <code>Presence Nothing Nothing Nothing Nothing Available
[]</code>. []</code>.
Now, let's say that we want to receive all message stanzas, and echo the stanzas Now, let's say that we want to receive all message stanzas, and echo the stanzas
back to the recipient. This can be done like so: back to the sender. This can be done like so:
forever $ do forever $ do
msg <- getMessage sess msg <- getMessage sess

2
source/Network/Xmpp/Concurrent/Monad.hs

@ -93,7 +93,7 @@ runHandler h session = h =<< atomically (readTMVar $ eventHandlers session)
-- | End the current XMPP session. Kills the associated threads and closes the -- | End the current XMPP session. Kills the associated threads and closes the
-- connection. -- connection.
-- --
-- Note that XMPP clients (that has signalled availability) should send -- Note that XMPP clients (that have signalled availability) should send
-- \"Unavailable\" presence prior to disconnecting. -- \"Unavailable\" presence prior to disconnecting.
-- --
-- The connectionClosedHandler will not be called (to avoid possibly -- The connectionClosedHandler will not be called (to avoid possibly

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

@ -30,7 +30,7 @@ data InstantMessage = InstantMessage { imThread :: Maybe MessageThread
, imBody :: [MessageBody] , imBody :: [MessageBody]
} }
-- | Empty instant message -- | Empty instant message.
instantMessage :: InstantMessage instantMessage :: InstantMessage
instantMessage = InstantMessage { imThread = Nothing instantMessage = InstantMessage { imThread = Nothing
, imSubject = [] , imSubject = []
@ -49,7 +49,7 @@ 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 are -- | Append IM data to a message. Additional IM bodies with the same Langtag are
-- discarded -- 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,11 +65,11 @@ simpleIM to bd = withIM message{messageTo = Just to}
instantMessage{imBody = [MessageBody Nothing bd]} instantMessage{imBody = [MessageBody Nothing bd]}
-- | 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. -- thread are inherited.
-- --
-- Additional IM bodies with the same Langtag are discarded -- 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

4
source/Network/Xmpp/IM/Presence.hs

@ -29,8 +29,8 @@ imPresence = IMP { showStatus = Nothing
instance Default IMPresence where instance Default IMPresence where
def = imPresence def = imPresence
-- | Try to extract RFC6121 IM presence information from presence stanza -- | Try to extract RFC6121 IM presence information from presence stanza.
-- Returns Nothing when the data is malformed, (Just IMPresence) otherwise -- Returns Nothing when the data is malformed, (Just IMPresence) otherwise.
getIMPresence :: Presence -> Maybe IMPresence getIMPresence :: Presence -> Maybe IMPresence
getIMPresence pres = case unpickle xpIMPresence (presencePayload pres) of getIMPresence pres = case unpickle xpIMPresence (presencePayload pres) of
Left _ -> Nothing Left _ -> Nothing

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

@ -32,7 +32,7 @@ timeout :: Maybe Integer
timeout = Just 3000000 -- 3 seconds timeout = Just 3000000 -- 3 seconds
-- | Push a roster item to the server. The values for approved and ask are -- | Push a roster item to the server. The values for approved and ask are
-- ignored and all values for subsciption except "remove" are ignored -- ignored and all values for subsciption except "remove" are ignored.
rosterPush :: Item -> Session -> IO (Either IQSendError (Annotated IQResponse)) rosterPush :: Item -> Session -> IO (Either IQSendError (Annotated IQResponse))
rosterPush item session = do rosterPush item session = do
let el = pickleElem xpQuery (Query Nothing [fromItem item]) let el = pickleElem xpQuery (Query Nothing [fromItem item])
@ -40,7 +40,7 @@ rosterPush item session = do
-- | Add or update an item to the roster. -- | Add or update an item to the roster.
-- --
-- To update the item just send the complete set of new data -- To update the item just send the complete set of new data.
rosterAdd :: Jid -- ^ JID of the item rosterAdd :: Jid -- ^ JID of the item
-> Maybe Text -- ^ Name alias -> Maybe Text -- ^ Name alias
-> [Text] -- ^ Groups (duplicates will be removed) -> [Text] -- ^ Groups (duplicates will be removed)
@ -57,7 +57,7 @@ rosterAdd j n gs session = do
}]) }])
sendIQA' timeout Nothing Set Nothing el session sendIQA' timeout Nothing Set Nothing el session
-- | Remove an item from the roster. Return True when the item is sucessfully -- | Remove an item from the roster. Return 'True' when the item is sucessfully
-- removed or if it wasn't in the roster to begin with. -- removed or if it wasn't in the roster to begin with.
rosterRemove :: Jid -> Session -> IO Bool rosterRemove :: Jid -> Session -> IO Bool
rosterRemove j sess = do rosterRemove j sess = do
@ -74,7 +74,8 @@ rosterRemove j sess = do
getRoster :: Session -> IO Roster getRoster :: Session -> IO Roster
getRoster session = atomically $ readTVar (rosterRef session) getRoster session = atomically $ readTVar (rosterRef session)
-- | Get the initial roster / refresh the roster. You don't need to call this on your own -- | Get the initial roster or refresh the roster. You don't need to call this
-- on your own.
initRoster :: Session -> IO () initRoster :: Session -> IO ()
initRoster session = do initRoster session = do
oldRoster <- getRoster session oldRoster <- getRoster session

6
source/Network/Xmpp/Types.hs

@ -449,7 +449,7 @@ data StreamErrorCondition
-- than \"http://etherx.jabber.org/streams\" (see -- than \"http://etherx.jabber.org/streams\" (see
-- Section 11.2) or the content namespace declared -- Section 11.2) or the content namespace declared
-- as the default namespace is not supported (e.g., -- as the default namespace is not supported (e.g.,
-- something other than "jabber:client" or -- something other than \"jabber:client\" or
-- \"jabber:server\"). -- \"jabber:server\").
| StreamInvalidXml -- ^ The entity has sent invalid XML over the stream to a | StreamInvalidXml -- ^ The entity has sent invalid XML over the stream to a
-- server that performs validation -- server that performs validation
@ -474,8 +474,8 @@ data StreamErrorCondition
-- not to be used when the cause of the error -- not to be used when the cause of the error
-- is within the administrative domain of the -- is within the administrative domain of the
-- XMPP service provider, in which case the -- XMPP service provider, in which case the
-- <internal-server-error/> condition is more -- \<internal-server-error /\> condition is
-- appropriate. -- more appropriate.
| StreamReset -- ^ The server is closing the stream because it has new | StreamReset -- ^ The server is closing the stream because it has new
-- (typically security-critical) features to offer, because -- (typically security-critical) features to offer, because
-- the keys or certificates used to establish a secure context -- the keys or certificates used to establish a secure context

Loading…
Cancel
Save