summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Taylor <bear42@gmail.com>2015-07-03 15:07:35 -0400
committerMike Taylor <bear42@gmail.com>2015-07-03 15:07:35 -0400
commitc024ac8f0b58d114d72660a1967f1632546606ed (patch)
tree5d1bb0dba79c46000fe2d4603ace49ddd6cc0c96
parenta8ac115310c1b9aaa80cc0d48a1157396b29abd3 (diff)
parentf00177c0cf5512a86b37ba69fc627ddf92abdc6b (diff)
downloadslixmpp-c024ac8f0b58d114d72660a1967f1632546606ed.tar.gz
slixmpp-c024ac8f0b58d114d72660a1967f1632546606ed.tar.bz2
slixmpp-c024ac8f0b58d114d72660a1967f1632546606ed.tar.xz
slixmpp-c024ac8f0b58d114d72660a1967f1632546606ed.zip
Merge pull request #382 from sangeeths/initialize_certificate
Initialize certfile, keyfile and ca_certs in XMLStream. Added **kwargs to ClientXMPP, BaseXMPP and XMLStream.
-rw-r--r--sleekxmpp/basexmpp.py4
-rw-r--r--sleekxmpp/clientxmpp.py7
-rw-r--r--sleekxmpp/xmlstream/cert.py2
-rw-r--r--sleekxmpp/xmlstream/xmlstream.py9
4 files changed, 12 insertions, 10 deletions
diff --git a/sleekxmpp/basexmpp.py b/sleekxmpp/basexmpp.py
index 8cd61b63..cb72b9bd 100644
--- a/sleekxmpp/basexmpp.py
+++ b/sleekxmpp/basexmpp.py
@@ -55,8 +55,8 @@ class BaseXMPP(XMLStream):
is used during initialization.
"""
- def __init__(self, jid='', default_ns='jabber:client'):
- XMLStream.__init__(self)
+ def __init__(self, jid='', default_ns='jabber:client', **kwargs):
+ XMLStream.__init__(self, **kwargs)
self.default_ns = default_ns
self.stream_ns = 'http://etherx.jabber.org/streams'
diff --git a/sleekxmpp/clientxmpp.py b/sleekxmpp/clientxmpp.py
index 8db6ef17..31a5a70b 100644
--- a/sleekxmpp/clientxmpp.py
+++ b/sleekxmpp/clientxmpp.py
@@ -59,14 +59,15 @@ class ClientXMPP(BaseXMPP):
:param escape_quotes: **Deprecated.**
"""
- def __init__(self, jid, password, plugin_config=None, plugin_whitelist=None, escape_quotes=True, sasl_mech=None,
- lang='en'):
+ def __init__(self, jid, password, plugin_config=None,
+ plugin_whitelist=None, escape_quotes=True, sasl_mech=None,
+ lang='en', **kwargs):
if not plugin_whitelist:
plugin_whitelist = []
if not plugin_config:
plugin_config = {}
- BaseXMPP.__init__(self, jid, 'jabber:client')
+ BaseXMPP.__init__(self, jid, 'jabber:client', **kwargs)
self.escape_quotes = escape_quotes
self.plugin_config = plugin_config
diff --git a/sleekxmpp/xmlstream/cert.py b/sleekxmpp/xmlstream/cert.py
index 71146f36..d357b326 100644
--- a/sleekxmpp/xmlstream/cert.py
+++ b/sleekxmpp/xmlstream/cert.py
@@ -181,4 +181,4 @@ def verify(expected, raw_cert):
return True
raise CertificateError(
- 'Could not match certficate against hostname: %s' % expected)
+ 'Could not match certificate against hostname: %s' % expected)
diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py
index f9ec4947..62d46100 100644
--- a/sleekxmpp/xmlstream/xmlstream.py
+++ b/sleekxmpp/xmlstream/xmlstream.py
@@ -114,7 +114,8 @@ class XMLStream(object):
:param int port: The port to use for the connection. Defaults to 0.
"""
- def __init__(self, socket=None, host='', port=0):
+ def __init__(self, socket=None, host='', port=0, certfile=None,
+ keyfile=None, ca_certs=None, **kwargs):
#: Most XMPP servers support TLSv1, but OpenFire in particular
#: does not work well with it. For OpenFire, set
#: :attr:`ssl_version` to use ``SSLv23``::
@@ -136,16 +137,16 @@ class XMLStream(object):
#:
#: On Mac OS X, certificates in the system keyring will
#: be consulted, even if they are not in the provided file.
- self.ca_certs = None
+ self.ca_certs = ca_certs
#: Path to a file containing a client certificate to use for
#: authenticating via SASL EXTERNAL. If set, there must also
#: be a corresponding `:attr:keyfile` value.
- self.certfile = None
+ self.certfile = certfile
#: Path to a file containing the private key for the selected
#: client certificate to use for authenticating via SASL EXTERNAL.
- self.keyfile = None
+ self.keyfile = keyfile
self._der_cert = None