diff options
author | mathieui <mathieui@mathieui.net> | 2015-02-23 19:16:26 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2015-02-24 22:46:04 +0100 |
commit | 3d243f7da5db99bfb7c88e572db92aa409abae2d (patch) | |
tree | 0ee8e7b49b317b48efe1e51a1243ecab19372fda | |
parent | ea5615f236bd80fb4217398977833ca790cbef71 (diff) | |
download | slixmpp-3d243f7da5db99bfb7c88e572db92aa409abae2d.tar.gz slixmpp-3d243f7da5db99bfb7c88e572db92aa409abae2d.tar.bz2 slixmpp-3d243f7da5db99bfb7c88e572db92aa409abae2d.tar.xz slixmpp-3d243f7da5db99bfb7c88e572db92aa409abae2d.zip |
XEP-0054: wrap functions with coroutine_wrapper
-rw-r--r-- | slixmpp/plugins/xep_0054/vcard_temp.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/slixmpp/plugins/xep_0054/vcard_temp.py b/slixmpp/plugins/xep_0054/vcard_temp.py index f7282e92..41849e60 100644 --- a/slixmpp/plugins/xep_0054/vcard_temp.py +++ b/slixmpp/plugins/xep_0054/vcard_temp.py @@ -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_0054 import VCardTemp, stanza +from slixmpp import coroutine_wrapper log = logging.getLogger(__name__) @@ -59,8 +60,9 @@ class XEP_0054(BasePlugin): def make_vcard(self): return VCardTemp() + @coroutine_wrapper def get_vcard(self, jid=None, ifrom=None, local=None, cached=False, - callback=None, timeout=None): + callback=None, timeout=None, coroutine=False): if local is None: if jid is not None and not isinstance(jid, JID): jid = JID(jid) @@ -99,10 +101,11 @@ class XEP_0054(BasePlugin): iq['type'] = 'get' iq.enable('vcard_temp') - iq.send(callback=callback, timeout=timeout) + return iq.send(callback=callback, timeout=timeout, coroutine=coroutine) + @coroutine_wrapper def publish_vcard(self, vcard=None, jid=None, ifrom=None, - callback=None, timeout=None): + callback=None, timeout=None, coroutine=False): self.api['set_vcard'](jid, None, ifrom, vcard) if self.xmpp.is_component: return @@ -112,7 +115,7 @@ class XEP_0054(BasePlugin): iq['from'] = ifrom iq['type'] = 'set' iq.append(vcard) - return iq.send(callback=callback, timeout=timeout) + return iq.send(callback=callback, timeout=timeout, coroutine=coroutine) def _handle_get_vcard(self, iq): if iq['type'] == 'result': |