summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2015-02-23 19:29:11 +0100
committermathieui <mathieui@mathieui.net>2015-02-24 22:46:04 +0100
commite68135f59f9a224688679eb91e8063041d6f000b (patch)
tree1fd7c500d86c491520e6217948332c795f6e7fe4
parent6408c5a7478438f8b873486a0a9ea1c400072c28 (diff)
downloadslixmpp-e68135f59f9a224688679eb91e8063041d6f000b.tar.gz
slixmpp-e68135f59f9a224688679eb91e8063041d6f000b.tar.bz2
slixmpp-e68135f59f9a224688679eb91e8063041d6f000b.tar.xz
slixmpp-e68135f59f9a224688679eb91e8063041d6f000b.zip
XEP-0049: wrap functions with coroutine_wrapper
-rw-r--r--slixmpp/plugins/xep_0049/private_storage.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/slixmpp/plugins/xep_0049/private_storage.py b/slixmpp/plugins/xep_0049/private_storage.py
index a66c05d1..32309069 100644
--- a/slixmpp/plugins/xep_0049/private_storage.py
+++ b/slixmpp/plugins/xep_0049/private_storage.py
@@ -9,6 +9,7 @@
import logging
from slixmpp import Iq
+from slixmpp import coroutine_wrapper
from slixmpp.plugins import BasePlugin
from slixmpp.xmlstream.handler import Callback
from slixmpp.xmlstream.matcher import StanzaPath
@@ -32,8 +33,9 @@ class XEP_0049(BasePlugin):
def register(self, stanza):
register_stanza_plugin(PrivateXML, stanza, iterable=True)
+ @coroutine_wrapper
def store(self, data, ifrom=None, timeout=None, callback=None,
- timeout_callback=None):
+ timeout_callback=None, coroutine=False):
iq = self.xmpp.Iq()
iq['type'] = 'set'
iq['from'] = ifrom
@@ -44,14 +46,15 @@ class XEP_0049(BasePlugin):
for elem in data:
iq['private'].append(elem)
- return iq.send(timeout=timeout, callback=callback,
+ return iq.send(timeout=timeout, callback=callback, coroutine=coroutine,
timeout_callback=timeout_callback)
+ @coroutine_wrapper
def retrieve(self, name, ifrom=None, timeout=None, callback=None,
- timeout_callback=None):
+ timeout_callback=None, coroutine=False):
iq = self.xmpp.Iq()
iq['type'] = 'get'
iq['from'] = ifrom
iq['private'].enable(name)
- return iq.send(timeout=timeout, callback=callback,
- timeout_callback=timeout_callback)
+ return iq.send(timeout=timeout, callback=callback, coroutine=coroutine,
+ timeout_callback=timeout_callback)