summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2015-02-23 19:31:21 +0100
committermathieui <mathieui@mathieui.net>2015-02-24 22:46:05 +0100
commit4da870fd191697d010e677eee32ef86439967353 (patch)
treeb41a448f2beb96a5a769209e3176440ac1040ae7
parentcd7ff685fbfe9755b8ba88ed5fd86a8450e637c1 (diff)
downloadslixmpp-4da870fd191697d010e677eee32ef86439967353.tar.gz
slixmpp-4da870fd191697d010e677eee32ef86439967353.tar.bz2
slixmpp-4da870fd191697d010e677eee32ef86439967353.tar.xz
slixmpp-4da870fd191697d010e677eee32ef86439967353.zip
XEP-0257: wrap functions with coroutine_wrapper
-rw-r--r--slixmpp/plugins/xep_0257/client_cert_management.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/slixmpp/plugins/xep_0257/client_cert_management.py b/slixmpp/plugins/xep_0257/client_cert_management.py
index 729197e0..552d5e9f 100644
--- a/slixmpp/plugins/xep_0257/client_cert_management.py
+++ b/slixmpp/plugins/xep_0257/client_cert_management.py
@@ -10,6 +10,7 @@ import logging
from slixmpp import Iq
from slixmpp.plugins import BasePlugin
+from slixmpp import coroutine_wrapper
from slixmpp.xmlstream import register_stanza_plugin
from slixmpp.plugins.xep_0257 import stanza, Certs
from slixmpp.plugins.xep_0257 import AppendCert, DisableCert, RevokeCert
@@ -31,35 +32,39 @@ class XEP_0257(BasePlugin):
register_stanza_plugin(Iq, DisableCert)
register_stanza_plugin(Iq, RevokeCert)
- def get_certs(self, ifrom=None, timeout=None, callback=None):
+ @coroutine_wrapper
+ def get_certs(self, ifrom=None, timeout=None, callback=None, coroutine=False):
iq = self.xmpp.Iq()
iq['type'] = 'get'
iq['from'] = ifrom
iq.enable('sasl_certs')
- return iq.send(timeout=timeout, callback=callback)
+ return iq.send(timeout=timeout, callback=callback, coroutine=coroutine)
+ @coroutine_wrapper
def add_cert(self, name, cert, allow_management=True, ifrom=None,
- timeout=None, callback=None):
+ timeout=None, callback=None, coroutine=False):
iq = self.xmpp.Iq()
iq['type'] = 'set'
iq['from'] = ifrom
iq['sasl_cert_append']['name'] = name
iq['sasl_cert_append']['x509cert'] = cert
iq['sasl_cert_append']['cert_management'] = allow_management
- return iq.send(timeout=timeout, callback=callback)
+ return iq.send(timeout=timeout, callback=callback, coroutine=coroutine)
- def disable_cert(self, name, ifrom=None,
+ @coroutine_wrapper
+ def disable_cert(self, name, ifrom=None, coroutine=False,
timeout=None, callback=None):
iq = self.xmpp.Iq()
iq['type'] = 'set'
iq['from'] = ifrom
iq['sasl_cert_disable']['name'] = name
- return iq.send(timeout=timeout, callback=callback)
+ return iq.send(timeout=timeout, callback=callback, coroutine=coroutine)
- def revoke_cert(self, name, ifrom=None,
+ @coroutine_wrapper
+ def revoke_cert(self, name, ifrom=None, coroutine=False,
timeout=None, callback=None):
iq = self.xmpp.Iq()
iq['type'] = 'set'
iq['from'] = ifrom
iq['sasl_cert_revoke']['name'] = name
- return iq.send(timeout=timeout, callback=callback)
+ return iq.send(timeout=timeout, callback=callback, coroutine=coroutine)