summaryrefslogtreecommitdiff
path: root/sleekxmpp/util
diff options
context:
space:
mode:
Diffstat (limited to 'sleekxmpp/util')
-rw-r--r--sleekxmpp/util/misc_ops.py7
-rw-r--r--sleekxmpp/util/sasl/__init__.py4
-rw-r--r--sleekxmpp/util/sasl/client.py4
-rw-r--r--sleekxmpp/util/sasl/mechanisms.py14
-rw-r--r--sleekxmpp/util/stringprep_profiles.py3
5 files changed, 21 insertions, 11 deletions
diff --git a/sleekxmpp/util/misc_ops.py b/sleekxmpp/util/misc_ops.py
index 3b246625..c2533eec 100644
--- a/sleekxmpp/util/misc_ops.py
+++ b/sleekxmpp/util/misc_ops.py
@@ -8,7 +8,10 @@ def unicode(text):
text = text.decode('utf-8')
import __builtin__
return __builtin__.unicode(text)
- return str(text)
+ elif not isinstance(text, str):
+ return text.decode('utf-8')
+ else:
+ return text
def bytes(text):
@@ -148,4 +151,4 @@ def setdefaultencoding(encoding):
if func is None:
raise RuntimeError("Could not find setdefaultencoding")
sys.setdefaultencoding = func
- return func(encoding) \ No newline at end of file
+ return func(encoding)
diff --git a/sleekxmpp/util/sasl/__init__.py b/sleekxmpp/util/sasl/__init__.py
index d054ce09..2d344e9b 100644
--- a/sleekxmpp/util/sasl/__init__.py
+++ b/sleekxmpp/util/sasl/__init__.py
@@ -7,7 +7,9 @@
Part of SleekXMPP: The Sleek XMPP Library
- :copyright: (c) 2012 Nathanael C. Fritz, Lance J.T. Stout
+ :copryight: (c) 2004-2013 David Alan Cridland
+ :copyright: (c) 2013 Nathanael C. Fritz, Lance J.T. Stout
+
:license: MIT, see LICENSE for more details
"""
diff --git a/sleekxmpp/util/sasl/client.py b/sleekxmpp/util/sasl/client.py
index 0bfb63f8..fd685547 100644
--- a/sleekxmpp/util/sasl/client.py
+++ b/sleekxmpp/util/sasl/client.py
@@ -7,7 +7,9 @@
Part of SleekXMPP: The Sleek XMPP Library
- :copyright: (c) 2012 Nathanael C. Fritz, Lance J.T. Stout
+ :copryight: (c) 2004-2013 David Alan Cridland
+ :copyright: (c) 2013 Nathanael C. Fritz, Lance J.T. Stout
+
:license: MIT, see LICENSE for more details
"""
diff --git a/sleekxmpp/util/sasl/mechanisms.py b/sleekxmpp/util/sasl/mechanisms.py
index 55ae44dd..1eb6af83 100644
--- a/sleekxmpp/util/sasl/mechanisms.py
+++ b/sleekxmpp/util/sasl/mechanisms.py
@@ -9,7 +9,9 @@
Part of SleekXMPP: The Sleek XMPP Library
- :copyright: (c) 2012 Nathanael C. Fritz, Lance J.T. Stout
+ :copryight: (c) 2004-2013 David Alan Cridland
+ :copyright: (c) 2013 Nathanael C. Fritz, Lance J.T. Stout
+
:license: MIT, see LICENSE for more details
"""
@@ -21,7 +23,8 @@ from base64 import b64encode, b64decode
from sleekxmpp.util import bytes, hash, XOR, quote, num_to_bytes
from sleekxmpp.util.sasl.client import sasl_mech, Mech, \
- SASLCancelled, SASLFailed
+ SASLCancelled, SASLFailed, \
+ SASLMutualAuthFailed
@sasl_mech(0)
@@ -86,7 +89,7 @@ class EXTERNAL(Mech):
return self.credentials['authzid']
-@sasl_mech(30)
+@sasl_mech(31)
class X_FACEBOOK_PLATFORM(Mech):
name = 'X-FACEBOOK-PLATFORM'
@@ -467,7 +470,8 @@ class DIGEST(Mech):
'qop': self.qop,
'digest-uri': quote(self.digest_uri()),
'response': self.response(b'AUTHENTICATE'),
- 'maxbuf': self.maxbuf
+ 'maxbuf': self.maxbuf,
+ 'charset': 'utf-8'
}
resp = b''
for key, value in data.items():
@@ -480,7 +484,7 @@ class DIGEST(Mech):
if self.cnonce and self.nonce and self.nonce_count and self.qop:
self.nonce_count += 1
return self.respond()
- return b''
+ return None
data = self.parse(challenge)
if 'rspauth' in data:
diff --git a/sleekxmpp/util/stringprep_profiles.py b/sleekxmpp/util/stringprep_profiles.py
index ad89d4cc..84326bc3 100644
--- a/sleekxmpp/util/stringprep_profiles.py
+++ b/sleekxmpp/util/stringprep_profiles.py
@@ -16,9 +16,8 @@
from __future__ import unicode_literals
-import sys
import stringprep
-import unicodedata
+from unicodedata import ucd_3_2_0 as unicodedata
from sleekxmpp.util import unicode