From a057326c1390ee8406d9dd675a7f20e04884c939 Mon Sep 17 00:00:00 2001 From: Philipp Balzarek Date: Sun, 9 Dec 2012 13:57:51 +0100 Subject: [PATCH] rename XmppConnectionState to ConnectionState --- source/Network/Xmpp/Basic.hs | 2 +- source/Network/Xmpp/Concurrent/Threads.hs | 2 +- source/Network/Xmpp/Connection.hs | 4 ++-- source/Network/Xmpp/Sasl.hs | 2 +- source/Network/Xmpp/Stream.hs | 4 ++-- source/Network/Xmpp/TLS.hs | 8 ++++---- source/Network/Xmpp/Types.hs | 12 ++++++------ 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/source/Network/Xmpp/Basic.hs b/source/Network/Xmpp/Basic.hs index 5cb3fb7..4f31f0a 100644 --- a/source/Network/Xmpp/Basic.hs +++ b/source/Network/Xmpp/Basic.hs @@ -1,6 +1,6 @@ module Network.Xmpp.Basic ( Connection(..) - , XmppConnectionState(..) + , ConnectionState(..) , connectTcp , simpleConnect , startTLS diff --git a/source/Network/Xmpp/Concurrent/Threads.hs b/source/Network/Xmpp/Concurrent/Threads.hs index e1f43e5..1ab1a23 100644 --- a/source/Network/Xmpp/Concurrent/Threads.hs +++ b/source/Network/Xmpp/Concurrent/Threads.hs @@ -34,7 +34,7 @@ readWorker onStanza onConnectionClosed stateRef = s <- atomically $ do con@(Connection con_) <- readTMVar stateRef state <- sConnectionState <$> readTMVar con_ - when (state == XmppConnectionClosed) + when (state == ConnectionClosed) retry return con allowInterrupt diff --git a/source/Network/Xmpp/Connection.hs b/source/Network/Xmpp/Connection.hs index de4bd52..2269d8b 100644 --- a/source/Network/Xmpp/Connection.hs +++ b/source/Network/Xmpp/Connection.hs @@ -127,7 +127,7 @@ xmppNoConnection = Connection_ } , cEventSource = DCI.ResumableSource zeroSource (return ()) , sFeatures = SF Nothing [] [] - , sConnectionState = XmppConnectionClosed + , sConnectionState = ConnectionClosed , sHostname = Nothing , sJid = Nothing , sStreamLang = Nothing @@ -167,7 +167,7 @@ connectTcpRaw host port hostname = do { cHand = hand , cEventSource = eSource , sFeatures = (SF Nothing [] []) - , sConnectionState = XmppConnectionPlain + , sConnectionState = ConnectionPlain , sHostname = (Just hostname) , sJid = Nothing , sPreferredLang = Nothing -- TODO: Allow user to set diff --git a/source/Network/Xmpp/Sasl.hs b/source/Network/Xmpp/Sasl.hs index 5ad5d36..0563398 100644 --- a/source/Network/Xmpp/Sasl.hs +++ b/source/Network/Xmpp/Sasl.hs @@ -54,7 +54,7 @@ xmppSasl handlers = withConnection $ do (_name, handler):_ -> runErrorT $ do cs <- gets sConnectionState case cs of - XmppConnectionClosed -> throwError AuthConnectionError + ConnectionClosed -> throwError AuthConnectionError _ -> do r <- handler _ <- ErrorT $ left AuthStreamError <$> restartStream diff --git a/source/Network/Xmpp/Stream.hs b/source/Network/Xmpp/Stream.hs index 303db8c..9af9a5c 100644 --- a/source/Network/Xmpp/Stream.hs +++ b/source/Network/Xmpp/Stream.hs @@ -67,9 +67,9 @@ startStream = runErrorT $ do state <- get -- Set the `to' attribute depending on the state of the connection. let from = case sConnectionState state of - XmppConnectionPlain -> if sJidWhenPlain state + ConnectionPlain -> if sJidWhenPlain state then sJid state else Nothing - XmppConnectionSecured -> sJid state + ConnectionSecured -> sJid state case sHostname state of Nothing -> throwError StreamConnectionError Just hostname -> lift $ do diff --git a/source/Network/Xmpp/TLS.hs b/source/Network/Xmpp/TLS.hs index 6ffa991..13742c7 100644 --- a/source/Network/Xmpp/TLS.hs +++ b/source/Network/Xmpp/TLS.hs @@ -93,9 +93,9 @@ startTLS params con = Ex.handle (return . Left . TLSError) features <- lift $ gets sFeatures state <- gets sConnectionState case state of - XmppConnectionPlain -> return () - XmppConnectionClosed -> throwError TLSNoConnection - XmppConnectionSecured -> throwError TLSConnectionSecured + ConnectionPlain -> return () + ConnectionClosed -> throwError TLSNoConnection + ConnectionSecured -> throwError TLSConnectionSecured con <- lift $ gets cHand when (stls features == Nothing) $ throwError TLSNoServerSupport lift $ pushElement starttlsE @@ -115,5 +115,5 @@ startTLS params con = Ex.handle (return . Left . TLSError) } lift $ modify ( \x -> x {cHand = newHand}) either (lift . Ex.throwIO) return =<< lift restartStream - modify (\s -> s{sConnectionState = XmppConnectionSecured}) + modify (\s -> s{sConnectionState = ConnectionSecured}) return () diff --git a/source/Network/Xmpp/Types.hs b/source/Network/Xmpp/Types.hs index 6ad94b9..63e139a 100644 --- a/source/Network/Xmpp/Types.hs +++ b/source/Network/Xmpp/Types.hs @@ -37,7 +37,7 @@ module Network.Xmpp.Types , withConnection , withConnection' , mkConnection - , XmppConnectionState(..) + , ConnectionState(..) , XmppStreamError(..) , langTag , module Network.Xmpp.Jid @@ -740,10 +740,10 @@ data ServerFeatures = SF , other :: ![Element] } deriving Show -data XmppConnectionState - = XmppConnectionClosed -- ^ No connection at this point. - | XmppConnectionPlain -- ^ Connection established, but not secured. - | XmppConnectionSecured -- ^ Connection established and secured via TLS. +data ConnectionState + = ConnectionClosed -- ^ No connection at this point. + | ConnectionPlain -- ^ Connection established, but not secured. + | ConnectionSecured -- ^ Connection established and secured via TLS. deriving (Show, Eq, Typeable) data HandleLike = Hand { cSend :: BS.ByteString -> IO Bool @@ -756,7 +756,7 @@ data HandleLike = Hand { cSend :: BS.ByteString -> IO Bool } data Connection_ = Connection_ - { sConnectionState :: !XmppConnectionState -- ^ State of + { sConnectionState :: !ConnectionState -- ^ State of -- connection , cHand :: HandleLike , cEventSource :: ResumableSource IO Event