Browse Source

Apply some additional minor Haddock fixes

master
Jon Kristensen 12 years ago
parent
commit
47d8fcac49
  1. 30
      source/Network/Xmpp/Concurrent.hs
  2. 3
      source/Network/Xmpp/Concurrent/Message.hs
  3. 13
      source/Network/Xmpp/Concurrent/Monad.hs

30
source/Network/Xmpp/Concurrent.hs

@ -195,8 +195,11 @@ session realm mbSasl config = runErrorT $ do
liftIO $ when (enableRoster config) $ initRoster ses liftIO $ when (enableRoster config) $ initRoster ses
return ses return ses
-- | Reconnect immediately with the stored settings. Returns Just the error when -- | Reconnect immediately with the stored settings. Returns @Just@ the error
-- the reconnect attempt fails and Nothing when no failure was encountered -- when the reconnect attempt fails and Nothing when no failure was encountered.
--
-- This function does not set your presence to online, so you will have to do
-- this yourself.
reconnectNow :: Session -- ^ session to reconnect reconnectNow :: Session -- ^ session to reconnect
-> IO (Maybe XmppFailure) -> IO (Maybe XmppFailure)
reconnectNow sess@Session{conf = config, reconnectWait = rw} = do reconnectNow sess@Session{conf = config, reconnectWait = rw} = do
@ -234,17 +237,20 @@ reconnectNow sess@Session{conf = config, reconnectWait = rw} = do
return Nothing return Nothing
-- | Reconnect with the stored settings. Returns a list of errors when the -- | Reconnect with the stored settings.
-- reconnect attempt fail and Nothing when no failure was encountered
-- --
-- Waits a random amount of seconds (between 0 and 60 inclusive) before the -- Waits a random amount of seconds (between 0 and 60 inclusive) before the
-- first attempt and an increasing amount after each attempt after that. Caps -- first attempt and an increasing amount after each attempt after that. Caps
-- out at 2-5 minutes. -- out at 2-5 minutes.
reconnect :: Integer -- ^ maximum number of retries (Nothing for --
-- unbounded). Numbers of 1 or less will perform exactly -- This function does not set your presence to online, so you will have to do
-- one retry -- this yourself.
-> Session -- ^ session to reconnect reconnect :: Integer -- ^ Maximum number of retries (numbers of 1 or less will
-> IO (Bool, [XmppFailure]) -- ^ The failure modes of the retries -- perform exactly one retry)
-> Session -- ^ Session to reconnect
-> IO (Bool, [XmppFailure]) -- ^ Whether or not the reconnect attempt
-- was successful, and a list of failure
-- modes encountered
reconnect maxTries sess = go maxTries reconnect maxTries sess = go maxTries
where where
go t = do go t = do
@ -260,8 +266,10 @@ reconnect maxTries sess = go maxTries
-- first attempt and an increasing amount after each attempt after that. Caps -- first attempt and an increasing amount after each attempt after that. Caps
-- out at 2-5 minutes. -- out at 2-5 minutes.
-- --
reconnect' :: Session -- ^ session to reconnect -- This function does not set your presence to online, so you will have to do
-> IO Integer -- ^ number of failed retries before connection could be -- this yourself.
reconnect' :: Session -- ^ Session to reconnect
-> IO Integer -- ^ Number of failed retries before connection could be
-- established -- established
reconnect' sess = go 0 reconnect' sess = go 0
where where

3
source/Network/Xmpp/Concurrent/Message.hs

@ -52,6 +52,7 @@ filterMessages f g session = do
Right m | g m -> return $ Right m Right m | g m -> return $ Right m
| otherwise -> filterMessages f g session | otherwise -> filterMessages f g session
-- | Send a message stanza. Returns False when the Message could not be sentx -- | Send a message stanza. Returns @False@ when the 'Message' could not be
-- sent.
sendMessage :: Message -> Session -> IO Bool sendMessage :: Message -> Session -> IO Bool
sendMessage m session = sendStanza (MessageS m) session sendMessage m session = sendStanza (MessageS m) session

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

@ -90,11 +90,14 @@ runHandler :: (EventHandlers -> IO a) -> Session -> IO a
runHandler h session = h =<< atomically (readTMVar $ eventHandlers session) runHandler h session = h =<< atomically (readTMVar $ eventHandlers session)
-- | End the current Xmpp session. -- | End the current XMPP session. Kills the associated threads and closes the
-- Kills the associated threads and closes the connection. -- connection.
--
-- Note that XMPP clients (that has signalled availability) should send
-- \"Unavailable\" presence prior to disconnecting.
-- --
-- The connectionClosedHandler will not be called (to avoid possibly -- The connectionClosedHandler will not be called (to avoid possibly
-- reestablishing the connection) -- reestablishing the connection).
endSession :: Session -> IO () endSession :: Session -> IO ()
endSession session = do -- TODO: This has to be idempotent (is it?) endSession session = do -- TODO: This has to be idempotent (is it?)
stopThreads session stopThreads session
@ -105,8 +108,8 @@ endSession session = do -- TODO: This has to be idempotent (is it?)
-- | Close the connection to the server. Closes the stream (by enforcing a -- | Close the connection to the server. Closes the stream (by enforcing a
-- write lock and sending a </stream:stream> element), waits (blocks) for three -- write lock and sending a \</stream:stream\> element), waits (blocks) for
-- seconds, and then closes the connection. -- three seconds, and then closes the connection.
closeConnection :: Session -> IO () closeConnection :: Session -> IO ()
closeConnection session = do closeConnection session = do
_ <-flip withConnection session $ \stream -> do _ <-flip withConnection session $ \stream -> do

Loading…
Cancel
Save