From 2c797c8bca96d03a74e5db349af3576f7e6c83bc Mon Sep 17 00:00:00 2001 From: Philipp Balzarek Date: Wed, 13 Jun 2012 18:17:13 +0200 Subject: [PATCH] remove sessionEndHandler --- source/Network/Xmpp.hs | 1 - source/Network/Xmpp/Concurrent/Monad.hs | 7 ------- source/Network/Xmpp/Concurrent/Threads.hs | 3 +-- source/Network/Xmpp/Concurrent/Types.hs | 3 +-- 4 files changed, 2 insertions(+), 12 deletions(-) diff --git a/source/Network/Xmpp.hs b/source/Network/Xmpp.hs index e651f32..ee93fe3 100644 --- a/source/Network/Xmpp.hs +++ b/source/Network/Xmpp.hs @@ -37,7 +37,6 @@ module Network.Xmpp , startTLS , auth , endSession - , setSessionEndHandler , setConnectionClosedHandler -- * JID -- | A JID (historically: Jabber ID) is XMPPs native format diff --git a/source/Network/Xmpp/Concurrent/Monad.hs b/source/Network/Xmpp/Concurrent/Monad.hs index e879ecb..0d6102c 100644 --- a/source/Network/Xmpp/Concurrent/Monad.hs +++ b/source/Network/Xmpp/Concurrent/Monad.hs @@ -224,12 +224,6 @@ modifyHandlers f = do eh <- asks eventHandlers 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. setConnectionClosedHandler :: (StreamError -> Xmpp ()) -> Xmpp () setConnectionClosedHandler eh = do @@ -247,7 +241,6 @@ endSession :: Xmpp () endSession = do -- TODO: This has to be idempotent (is it?) void $ withConnection xmppKillConnection liftIO =<< asks stopThreads - runHandler sessionEndHandler -- | Close the connection to the server. closeConnection :: Xmpp () diff --git a/source/Network/Xmpp/Concurrent/Threads.hs b/source/Network/Xmpp/Concurrent/Threads.hs index 5d81db3..3dba714 100644 --- a/source/Network/Xmpp/Concurrent/Threads.hs +++ b/source/Network/Xmpp/Concurrent/Threads.hs @@ -189,8 +189,7 @@ startThreads = do return () zeroEventHandlers :: EventHandlers zeroEventHandlers = EventHandlers - { sessionEndHandler = return () - , connectionClosedHandler = \_ -> return () + { connectionClosedHandler = \_ -> return () } -- | Creates and initializes a new Xmpp session. diff --git a/source/Network/Xmpp/Concurrent/Types.hs b/source/Network/Xmpp/Concurrent/Types.hs index e299dc4..6772df1 100644 --- a/source/Network/Xmpp/Concurrent/Types.hs +++ b/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 -- closed. data EventHandlers = EventHandlers - { sessionEndHandler :: IO () - , connectionClosedHandler :: StreamError -> IO () + { connectionClosedHandler :: StreamError -> IO () } -- The Session object is the Xmpp (ReaderT) state.