From 4da870fd191697d010e677eee32ef86439967353 Mon Sep 17 00:00:00 2001 From: mathieui Date: Mon, 23 Feb 2015 19:31:21 +0100 Subject: XEP-0257: wrap functions with coroutine_wrapper --- slixmpp/plugins/xep_0257/client_cert_management.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'slixmpp/plugins/xep_0257/client_cert_management.py') 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) -- cgit v1.2.3