XEP-0092: wrap get_version() with coroutine_wrapper

This commit is contained in:
mathieui 2015-02-23 19:32:48 +01:00
parent 4da870fd19
commit 6e35948276
No known key found for this signature in database
GPG key ID: C59F84CEEFD616E3

View file

@ -15,6 +15,7 @@ from slixmpp.xmlstream.handler import Callback
from slixmpp.xmlstream.matcher import StanzaPath
from slixmpp.plugins import BasePlugin
from slixmpp.plugins.xep_0092 import Version, stanza
from slixmpp import coroutine_wrapper
log = logging.getLogger(__name__)
@ -70,7 +71,9 @@ class XEP_0092(BasePlugin):
iq['software_version']['os'] = self.os
iq.send()
def get_version(self, jid, ifrom=None, timeout=None, callback=None):
@coroutine_wrapper
def get_version(self, jid, ifrom=None, timeout=None, callback=None,
coroutine=False):
"""
Retrieve the software version of a remote agent.
@ -82,4 +85,4 @@ class XEP_0092(BasePlugin):
iq['from'] = ifrom
iq['type'] = 'get'
iq['query'] = Version.namespace
return iq.send(timeout=timeout, callback=callback)
return iq.send(timeout=timeout, callback=callback, coroutine=coroutine)