plugin XEP-0166: added delayedContentTerminate to terminate a content inside a handler
This commit is contained in:
parent
a66843a884
commit
c3301733fb
1 changed files with 8 additions and 0 deletions
|
|
@ -25,6 +25,7 @@ log = getLogger(__name__)
|
||||||
from sat.core import exceptions
|
from sat.core import exceptions
|
||||||
from twisted.words.protocols.jabber import jid
|
from twisted.words.protocols.jabber import jid
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
|
from twisted.internet import reactor
|
||||||
from wokkel import disco, iwokkel
|
from wokkel import disco, iwokkel
|
||||||
from twisted.words.protocols.jabber import error
|
from twisted.words.protocols.jabber import error
|
||||||
from twisted.words.protocols.jabber import xmlstream
|
from twisted.words.protocols.jabber import xmlstream
|
||||||
|
|
@ -360,6 +361,13 @@ class XEP_0166(object):
|
||||||
d.addErrback(self._iqError, sid, client)
|
d.addErrback(self._iqError, sid, client)
|
||||||
yield d
|
yield d
|
||||||
|
|
||||||
|
def delayedContentTerminate(self, *args, **kwargs):
|
||||||
|
"""Put contentTerminate in queue but don't execute immediately
|
||||||
|
|
||||||
|
This is used to terminate a content inside a handler, to avoid modifying contents
|
||||||
|
"""
|
||||||
|
reactor.callLater(0, self.contentTerminate, *args, **kwargs)
|
||||||
|
|
||||||
def contentTerminate(self, session, content_name, reason=REASON_SUCCESS, profile=C.PROF_KEY_NONE):
|
def contentTerminate(self, session, content_name, reason=REASON_SUCCESS, profile=C.PROF_KEY_NONE):
|
||||||
"""Terminate and remove a content
|
"""Terminate and remove a content
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue