diff options
author | mathieui <mathieui@mathieui.net> | 2015-02-23 19:33:22 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2015-02-24 22:46:06 +0100 |
commit | 6e8235544cc1bdefea75a8d93e5e3a48a13552ba (patch) | |
tree | af0d1fde985810b1718c9823334a01951d05d628 | |
parent | 6e35948276c36ea2696f0de64dc179a1073ee3a6 (diff) | |
download | slixmpp-6e8235544cc1bdefea75a8d93e5e3a48a13552ba.tar.gz slixmpp-6e8235544cc1bdefea75a8d93e5e3a48a13552ba.tar.bz2 slixmpp-6e8235544cc1bdefea75a8d93e5e3a48a13552ba.tar.xz slixmpp-6e8235544cc1bdefea75a8d93e5e3a48a13552ba.zip |
XEP-0191: wrap functions with coroutine_wrapper
-rw-r--r-- | slixmpp/plugins/xep_0191/blocking.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/slixmpp/plugins/xep_0191/blocking.py b/slixmpp/plugins/xep_0191/blocking.py index 22610d78..9a6971a8 100644 --- a/slixmpp/plugins/xep_0191/blocking.py +++ b/slixmpp/plugins/xep_0191/blocking.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 @@ -45,14 +46,18 @@ class XEP_0191(BasePlugin): self.xmpp.remove_handler('Blocked Contact') self.xmpp.remove_handler('Unblocked Contact') - def get_blocked(self, ifrom=None, timeout=None, callback=None): + @coroutine_wrapper + def get_blocked(self, ifrom=None, timeout=None, callback=None, + coroutine=False): iq = self.xmpp.Iq() iq['type'] = 'get' iq['from'] = ifrom iq.enable('blocklist') - return iq.send(timeout=timeout, callback=callback) + return iq.send(timeout=timeout, callback=callback, coroutine=coroutine) - def block(self, jids, ifrom=None, timeout=None, callback=None): + @coroutine_wrapper + def block(self, jids, ifrom=None, timeout=None, callback=None, + coroutine=False): iq = self.xmpp.Iq() iq['type'] = 'set' iq['from'] = ifrom @@ -61,9 +66,11 @@ class XEP_0191(BasePlugin): jids = [jids] iq['block']['items'] = jids - return iq.send(timeout=timeout, callback=callback) + return iq.send(timeout=timeout, callback=callback, coroutine=coroutine) - def unblock(self, jids=None, ifrom=None, timeout=None, callback=None): + @coroutine_wrapper + def unblock(self, jids=None, ifrom=None, timeout=None, callback=None, + coroutine=False): iq = self.xmpp.Iq() iq['type'] = 'set' iq['from'] = ifrom @@ -74,7 +81,7 @@ class XEP_0191(BasePlugin): jids = [jids] iq['unblock']['items'] = jids - return iq.send(timeout=timeout, callback=callback) + return iq.send(timeout=timeout, callback=callback, coroutine=coroutine) def _handle_blocked(self, iq): self.xmpp.event('blocked', iq) |