Fix xep-0257 for slixmpp, and fix an element name

This commit is contained in:
mathieui 2014-12-11 14:46:52 +01:00
parent 5fcf08a415
commit 423974f90d
No known key found for this signature in database
GPG key ID: C59F84CEEFD616E3
2 changed files with 9 additions and 9 deletions

View file

@ -31,35 +31,35 @@ class XEP_0257(BasePlugin):
register_stanza_plugin(Iq, DisableCert)
register_stanza_plugin(Iq, RevokeCert)
def get_certs(self, ifrom=None, block=True, timeout=None, callback=None):
def get_certs(self, ifrom=None, timeout=None, callback=None):
iq = self.xmpp.Iq()
iq['type'] = 'get'
iq['from'] = ifrom
iq.enable('sasl_certs')
return iq.send(block=block, timeout=timeout, callback=callback)
return iq.send(timeout=timeout, callback=callback)
def add_cert(self, name, cert, allow_management=True, ifrom=None,
block=True, timeout=None, callback=None):
timeout=None, callback=None):
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(block=block, timeout=timeout, callback=callback)
return iq.send(timeout=timeout, callback=callback)
def disable_cert(self, name, ifrom=None, block=True,
def disable_cert(self, name, ifrom=None,
timeout=None, callback=None):
iq = self.xmpp.Iq()
iq['type'] = 'set'
iq['from'] = ifrom
iq['sasl_cert_disable']['name'] = name
return iq.send(block=block, timeout=timeout, callback=callback)
return iq.send(timeout=timeout, callback=callback)
def revoke_cert(self, name, ifrom=None, block=True,
def revoke_cert(self, name, ifrom=None,
timeout=None, callback=None):
iq = self.xmpp.Iq()
iq['type'] = 'set'
iq['from'] = ifrom
iq['sasl_cert_revoke']['name'] = name
return iq.send(block=block, timeout=timeout, callback=callback)
return iq.send(timeout=timeout, callback=callback)

View file

@ -10,7 +10,7 @@ from slixmpp.xmlstream import ElementBase, ET, register_stanza_plugin
class Certs(ElementBase):
name = 'query'
name = 'items'
namespace = 'urn:xmpp:saslcert:1'
plugin_attrib = 'sasl_certs'
interfaces = set()