Browse Source

add getStanza and getStanzaChan

master
Philipp Balzarek 13 years ago
parent
commit
a130d611f4
  1. 4
      source/Network/Xmpp.hs
  2. 8
      source/Network/Xmpp/Concurrent/Basic.hs

4
source/Network/Xmpp.hs

@ -76,7 +76,8 @@ module Network.Xmpp
-- presence, or IQ stanza. The particular allowable values for the 'type' -- presence, or IQ stanza. The particular allowable values for the 'type'
-- attribute vary depending on whether the stanza is a message, presence, -- attribute vary depending on whether the stanza is a message, presence,
-- or IQ stanza. -- or IQ stanza.
, getStanza
, getStanzaChan
-- ** Messages -- ** Messages
-- | The /message/ stanza is a /push/ mechanism whereby one entity -- | The /message/ stanza is a /push/ mechanism whereby one entity
-- pushes information to another entity, similar to the communications that -- 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.Sasl.Types
import Network.Xmpp.Stanza import Network.Xmpp.Stanza
import Network.Xmpp.Types import Network.Xmpp.Types
import Network.Xmpp.Utilities

8
source/Network/Xmpp/Concurrent/Basic.hs

@ -11,6 +11,14 @@ import Control.Monad.State.Strict
sendStanza :: Stanza -> Session -> IO () sendStanza :: Stanza -> Session -> IO ()
sendStanza a session = atomically $ writeTChan (outCh session) a 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 -- | Create a new session object with the inbound channel duplicated
dupSession :: Session -> IO Session dupSession :: Session -> IO Session
dupSession session = do dupSession session = do

Loading…
Cancel
Save