Browse Source

remove sessionEndHandler

master
Philipp Balzarek 14 years ago
parent
commit
2c797c8bca
  1. 1
      source/Network/Xmpp.hs
  2. 7
      source/Network/Xmpp/Concurrent/Monad.hs
  3. 3
      source/Network/Xmpp/Concurrent/Threads.hs
  4. 3
      source/Network/Xmpp/Concurrent/Types.hs

1
source/Network/Xmpp.hs

@ -37,7 +37,6 @@ module Network.Xmpp
, startTLS , startTLS
, auth , auth
, endSession , endSession
, setSessionEndHandler
, setConnectionClosedHandler , setConnectionClosedHandler
-- * JID -- * JID
-- | A JID (historically: Jabber ID) is XMPPs native format -- | A JID (historically: Jabber ID) is XMPPs native format

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

@ -224,12 +224,6 @@ modifyHandlers f = do
eh <- asks eventHandlers eh <- asks eventHandlers
liftIO . atomically $ writeTVar eh . f =<< readTVar eh liftIO . atomically $ writeTVar eh . f =<< readTVar eh
-- | Sets the handler to be executed when the session ends.
setSessionEndHandler :: Xmpp () -> Xmpp ()
setSessionEndHandler eh = do
r <- ask
modifyHandlers (\s -> s{sessionEndHandler = runReaderT eh r})
-- | Sets the handler to be executed when the server connection is closed. -- | Sets the handler to be executed when the server connection is closed.
setConnectionClosedHandler :: (StreamError -> Xmpp ()) -> Xmpp () setConnectionClosedHandler :: (StreamError -> Xmpp ()) -> Xmpp ()
setConnectionClosedHandler eh = do setConnectionClosedHandler eh = do
@ -247,7 +241,6 @@ endSession :: Xmpp ()
endSession = do -- TODO: This has to be idempotent (is it?) endSession = do -- TODO: This has to be idempotent (is it?)
void $ withConnection xmppKillConnection void $ withConnection xmppKillConnection
liftIO =<< asks stopThreads liftIO =<< asks stopThreads
runHandler sessionEndHandler
-- | Close the connection to the server. -- | Close the connection to the server.
closeConnection :: Xmpp () closeConnection :: Xmpp ()

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

@ -189,8 +189,7 @@ startThreads = do
return () return ()
zeroEventHandlers :: EventHandlers zeroEventHandlers :: EventHandlers
zeroEventHandlers = EventHandlers zeroEventHandlers = EventHandlers
{ sessionEndHandler = return () { connectionClosedHandler = \_ -> return ()
, connectionClosedHandler = \_ -> return ()
} }
-- | Creates and initializes a new Xmpp session. -- | Creates and initializes a new Xmpp session.

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

@ -25,8 +25,7 @@ type IQHandlers = (Map.Map (IQRequestType, Text) (TChan IQRequestTicket)
-- Handlers to be run when the Xmpp session ends and when the Xmpp connection is -- Handlers to be run when the Xmpp session ends and when the Xmpp connection is
-- closed. -- closed.
data EventHandlers = EventHandlers data EventHandlers = EventHandlers
{ sessionEndHandler :: IO () { connectionClosedHandler :: StreamError -> IO ()
, connectionClosedHandler :: StreamError -> IO ()
} }
-- The Session object is the Xmpp (ReaderT) state. -- The Session object is the Xmpp (ReaderT) state.

Loading…
Cancel
Save