Mercurial > libervia-backend
changeset 1617:d05f9179fe22
plugin XEP-0166: added delayedContentTerminate to terminate a content inside a handler
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 17 Nov 2015 19:41:30 +0100 |
parents | 1e05b776a55b |
children | 0de5f210fe56 |
files | src/plugins/plugin_xep_0166.py |
diffstat | 1 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0166.py Tue Nov 17 19:40:37 2015 +0100 +++ b/src/plugins/plugin_xep_0166.py Tue Nov 17 19:41:30 2015 +0100 @@ -25,6 +25,7 @@ from sat.core import exceptions from twisted.words.protocols.jabber import jid from twisted.internet import defer +from twisted.internet import reactor from wokkel import disco, iwokkel from twisted.words.protocols.jabber import error from twisted.words.protocols.jabber import xmlstream @@ -360,6 +361,13 @@ d.addErrback(self._iqError, sid, client) 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): """Terminate and remove a content