Browse Source

export setConnectionClosedHandler

master
Philipp Balzarek 13 years ago
parent
commit
34e80d8fe2
  1. 1
      source/Network/Xmpp.hs
  2. 8
      source/Network/Xmpp/Concurrent/Monad.hs

1
source/Network/Xmpp.hs

@ -27,6 +27,7 @@ module Network.Xmpp
( -- * Session management ( -- * Session management
Session Session
, session , session
, setConnectionClosedHandler
, StreamConfiguration(..) , StreamConfiguration(..)
, SessionConfiguration(..) , SessionConfiguration(..)
, ConnectionDetails(..) , ConnectionDetails(..)

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

@ -70,9 +70,11 @@ modifyHandlers f session = atomically $ modifyTVar_ (eventHandlers session) f
x <- readTVar var x <- readTVar var
writeTVar var (g x) writeTVar var (g x)
-- | Sets the handler to be executed when the server connection is closed. -- | Changes the handler to be executed when the server connection is closed. To
setConnectionClosedHandler_ :: (XmppFailure -> Session -> IO ()) -> Session -> IO () -- avoid race conditions the initial value should be set in the configuration
setConnectionClosedHandler_ eh session = do -- when creating the session
setConnectionClosedHandler :: (XmppFailure -> Session -> IO ()) -> Session -> IO ()
setConnectionClosedHandler eh session = do
modifyHandlers (\s -> s{connectionClosedHandler = modifyHandlers (\s -> s{connectionClosedHandler =
\e -> eh e session}) session \e -> eh e session}) session

Loading…
Cancel
Save