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

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

@ -52,6 +52,7 @@ filterMessages f g session = do @@ -52,6 +52,7 @@ filterMessages f g session = do
Right m | g m -> return $ Right m
| 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 m session = sendStanza (MessageS m) session

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

@ -90,11 +90,14 @@ runHandler :: (EventHandlers -> IO a) -> Session -> IO a @@ -90,11 +90,14 @@ runHandler :: (EventHandlers -> IO a) -> Session -> IO a
runHandler h session = h =<< atomically (readTMVar $ eventHandlers session)
-- | End the current Xmpp session.
-- Kills the associated threads and closes the connection.
-- | End the current XMPP session. Kills the associated threads and closes the
-- 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
-- reestablishing the connection)
-- reestablishing the connection).
endSession :: Session -> IO ()
endSession session = do -- TODO: This has to be idempotent (is it?)
stopThreads session
@ -105,8 +108,8 @@ endSession session = do -- TODO: This has to be idempotent (is it?) @@ -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
-- write lock and sending a </stream:stream> element), waits (blocks) for three
-- seconds, and then closes the connection.
-- write lock and sending a \</stream:stream\> element), waits (blocks) for
-- three seconds, and then closes the connection.
closeConnection :: Session -> IO ()
closeConnection session = do
_ <-flip withConnection session $ \stream -> do

Loading…
Cancel
Save