Browse Source

add dropIQChan

master
Philipp Balzarek 13 years ago
parent
commit
fad5e37384
  1. 1
      source/Network/Xmpp.hs
  2. 15
      source/Network/Xmpp/Concurrent/IQ.hs

1
source/Network/Xmpp.hs

@ -138,6 +138,7 @@ module Network.Xmpp
, sendIQ' , sendIQ'
, answerIQ , answerIQ
, listenIQChan , listenIQChan
, dropIQChan
-- * Errors -- * Errors
, StanzaError(..) , StanzaError(..)
, StanzaErrorType(..) , StanzaErrorType(..)

15
source/Network/Xmpp/Concurrent/IQ.hs

@ -83,6 +83,21 @@ listenIQChan tp ns session = do
Nothing -> Right iqCh Nothing -> Right iqCh
Just iqCh' -> Left iqCh' Just iqCh' -> Left iqCh'
-- | Unregister a previously acquired IQ channel. Please make sure that you
-- where the one who acquired it in the first place as no check for ownership
-- can be made
dropIQChan :: IQRequestType -- ^ Type of IQ ('Get' or 'Set')
-> Text -- ^ Namespace of the child element
-> Session
-> IO ()
dropIQChan tp ns session = do
let handlers = (iqHandlers session)
atomically $ do
(byNS, byID) <- readTVar handlers
let byNS' = Map.delete (tp, ns) byNS
writeTVar handlers (byNS', byID)
return ()
answerIQ :: IQRequestTicket answerIQ :: IQRequestTicket
-> Either StanzaError (Maybe Element) -> Either StanzaError (Maybe Element)
-> Session -> Session

Loading…
Cancel
Save