XEP-0258: wrap get_catalog() with coroutine_wrapper
This commit is contained in:
parent
17464b10a4
commit
18a4978456
@ -9,6 +9,7 @@
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from slixmpp import Iq, Message
|
from slixmpp import Iq, Message
|
||||||
|
from slixmpp import coroutine_wrapper
|
||||||
from slixmpp.plugins import BasePlugin
|
from slixmpp.plugins import BasePlugin
|
||||||
from slixmpp.xmlstream import register_stanza_plugin
|
from slixmpp.xmlstream import register_stanza_plugin
|
||||||
from slixmpp.plugins.xep_0258 import stanza, SecurityLabel, Catalog
|
from slixmpp.plugins.xep_0258 import stanza, SecurityLabel, Catalog
|
||||||
@ -34,11 +35,12 @@ class XEP_0258(BasePlugin):
|
|||||||
def session_bind(self, jid):
|
def session_bind(self, jid):
|
||||||
self.xmpp['xep_0030'].add_feature(SecurityLabel.namespace)
|
self.xmpp['xep_0030'].add_feature(SecurityLabel.namespace)
|
||||||
|
|
||||||
def get_catalog(self, jid, ifrom=None,
|
@coroutine_wrapper
|
||||||
|
def get_catalog(self, jid, ifrom=None, coroutine=False,
|
||||||
callback=None, timeout=None):
|
callback=None, timeout=None):
|
||||||
iq = self.xmpp.Iq()
|
iq = self.xmpp.Iq()
|
||||||
iq['to'] = jid
|
iq['to'] = jid
|
||||||
iq['from'] = ifrom
|
iq['from'] = ifrom
|
||||||
iq['type'] = 'get'
|
iq['type'] = 'get'
|
||||||
iq.enable('security_label_catalog')
|
iq.enable('security_label_catalog')
|
||||||
return iq.send(callback=callback, timeout=timeout)
|
return iq.send(callback=callback, timeout=timeout, coroutine=coroutine)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user