From a130d611f48731d12e7301668f5f93b8ed82763e Mon Sep 17 00:00:00 2001
From: Philipp Balzarek
Date: Sun, 19 May 2013 12:14:20 +0200
Subject: [PATCH] add getStanza and getStanzaChan
---
source/Network/Xmpp.hs | 4 ++--
source/Network/Xmpp/Concurrent/Basic.hs | 8 ++++++++
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/source/Network/Xmpp.hs b/source/Network/Xmpp.hs
index bc8281b..b693d56 100644
--- a/source/Network/Xmpp.hs
+++ b/source/Network/Xmpp.hs
@@ -76,7 +76,8 @@ module Network.Xmpp
-- presence, or IQ stanza. The particular allowable values for the 'type'
-- attribute vary depending on whether the stanza is a message, presence,
-- or IQ stanza.
-
+ , getStanza
+ , getStanzaChan
-- ** Messages
-- | The /message/ stanza is a /push/ mechanism whereby one entity
-- pushes information to another entity, similar to the communications that
@@ -169,4 +170,3 @@ import Network.Xmpp.Sasl
import Network.Xmpp.Sasl.Types
import Network.Xmpp.Stanza
import Network.Xmpp.Types
-import Network.Xmpp.Utilities
diff --git a/source/Network/Xmpp/Concurrent/Basic.hs b/source/Network/Xmpp/Concurrent/Basic.hs
index 912cba5..99623f9 100644
--- a/source/Network/Xmpp/Concurrent/Basic.hs
+++ b/source/Network/Xmpp/Concurrent/Basic.hs
@@ -11,6 +11,14 @@ import Control.Monad.State.Strict
sendStanza :: Stanza -> Session -> IO ()
sendStanza a session = atomically $ writeTChan (outCh session) a
+-- | Get the channel of incoming stanzas.
+getStanzaChan :: Session -> TChan Stanza
+getStanzaChan session = stanzaCh session
+
+-- | Get the next incoming stanza
+getStanza :: Session -> IO Stanza
+getStanza session = atomically . readTChan $ stanzaCh session
+
-- | Create a new session object with the inbound channel duplicated
dupSession :: Session -> IO Session
dupSession session = do