diff --git a/source/Network/Xmpp/Concurrent/Basic.hs b/source/Network/Xmpp/Concurrent/Basic.hs index a590f64..8c48559 100644 --- a/source/Network/Xmpp/Concurrent/Basic.hs +++ b/source/Network/Xmpp/Concurrent/Basic.hs @@ -51,3 +51,12 @@ getFeatures :: Session -> IO StreamFeatures getFeatures Session{streamRef = st} = do s <- atomically $ readTMVar st withStream' (gets streamFeatures) s + +waitForStream :: Session -> IO () +waitForStream Session{streamRef = sr} = atomically $ do + s <- readTMVar sr + ss <- readTMVar $ unStream s + case streamConnectionState ss of + Plain -> return () + Secured -> return () + _ -> retry