summaryrefslogtreecommitdiff
path: root/sleekxmpp
diff options
context:
space:
mode:
Diffstat (limited to 'sleekxmpp')
-rw-r--r--sleekxmpp/clientxmpp.py6
-rw-r--r--sleekxmpp/features/feature_mechanisms/stanza/auth.py2
-rw-r--r--sleekxmpp/roster/item.py3
-rw-r--r--sleekxmpp/roster/multi.py3
-rw-r--r--sleekxmpp/roster/single.py3
-rw-r--r--sleekxmpp/thirdparty/suelta/mechanisms/messenger_oauth2.py5
6 files changed, 17 insertions, 5 deletions
diff --git a/sleekxmpp/clientxmpp.py b/sleekxmpp/clientxmpp.py
index e3d210ae..36b135d3 100644
--- a/sleekxmpp/clientxmpp.py
+++ b/sleekxmpp/clientxmpp.py
@@ -237,9 +237,13 @@ class ClientXMPP(BaseXMPP):
iq = self.Iq()
iq['type'] = 'get'
iq.enable('roster')
+
+ if not block and callback is None:
+ callback = lambda resp: self._handle_roster(resp, request=True)
+
response = iq.send(block, timeout, callback)
- if callback is None:
+ if block:
return self._handle_roster(response, request=True)
def _handle_connected(self, event=None):
diff --git a/sleekxmpp/features/feature_mechanisms/stanza/auth.py b/sleekxmpp/features/feature_mechanisms/stanza/auth.py
index 9155adf6..d2a981f9 100644
--- a/sleekxmpp/features/feature_mechanisms/stanza/auth.py
+++ b/sleekxmpp/features/feature_mechanisms/stanza/auth.py
@@ -43,7 +43,7 @@ class Auth(StanzaBase):
if not self['mechanism'] in self.plain_mechs:
self.xml.text = bytes(base64.b64encode(values)).decode('utf-8')
else:
- self.xml.text = values
+ self.xml.text = bytes(values).decode('utf-8')
def del_value(self):
self.xml.text = ''
diff --git a/sleekxmpp/roster/item.py b/sleekxmpp/roster/item.py
index 6f956b31..bd7bbbde 100644
--- a/sleekxmpp/roster/item.py
+++ b/sleekxmpp/roster/item.py
@@ -482,3 +482,6 @@ class RosterItem(object):
a roster reset request.
"""
self.resources = {}
+
+ def __repr__(self):
+ return repr(self._state)
diff --git a/sleekxmpp/roster/multi.py b/sleekxmpp/roster/multi.py
index ee56f2a8..36c7e2ad 100644
--- a/sleekxmpp/roster/multi.py
+++ b/sleekxmpp/roster/multi.py
@@ -182,3 +182,6 @@ class Roster(object):
self._auto_subscribe = value
for node in self._rosters:
self._rosters[node].auto_subscribe = value
+
+ def __repr__(self):
+ return repr(self._rosters)
diff --git a/sleekxmpp/roster/single.py b/sleekxmpp/roster/single.py
index c2c7497d..903333a3 100644
--- a/sleekxmpp/roster/single.py
+++ b/sleekxmpp/roster/single.py
@@ -285,3 +285,6 @@ class RosterNode(object):
if not self.xmpp.sentpresence:
self.xmpp.event('sent_presence')
self.xmpp.sentpresence = True
+
+ def __repr__(self):
+ return repr(self._jids)
diff --git a/sleekxmpp/thirdparty/suelta/mechanisms/messenger_oauth2.py b/sleekxmpp/thirdparty/suelta/mechanisms/messenger_oauth2.py
index c72bc0e3..f5b0ddec 100644
--- a/sleekxmpp/thirdparty/suelta/mechanisms/messenger_oauth2.py
+++ b/sleekxmpp/thirdparty/suelta/mechanisms/messenger_oauth2.py
@@ -1,6 +1,5 @@
-from sleekxmpp.thirdparty.suelta.util import hash, bytes
+from sleekxmpp.thirdparty.suelta.util import bytes
from sleekxmpp.thirdparty.suelta.sasl import Mechanism, register_mechanism
-from sleekxmpp.thirdparty.suelta.exceptions import SASLError, SASLCancelled
class X_MESSENGER_OAUTH2(Mechanism):
@@ -10,7 +9,7 @@ class X_MESSENGER_OAUTH2(Mechanism):
self.check_values(['access_token'])
def process(self, challenge=None):
- return self.values['access_token']
+ return bytes(self.values['access_token'])
def okay(self):
return True