From 01e1878900f9206f7672b2f8a6fcfc28dbed5166 Mon Sep 17 00:00:00 2001 From: Tobias Friemel Date: Mon, 23 Dec 2013 16:19:49 +0100 Subject: [PATCH 1/2] Fix X-FACEBOOK-PLATFORM authentication in Python3. --- sleekxmpp/util/sasl/mechanisms.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sleekxmpp/util/sasl/mechanisms.py b/sleekxmpp/util/sasl/mechanisms.py index 1eb6af83..523eabc2 100644 --- a/sleekxmpp/util/sasl/mechanisms.py +++ b/sleekxmpp/util/sasl/mechanisms.py @@ -111,7 +111,7 @@ class X_FACEBOOK_PLATFORM(Mech): b'api_key': self.credentials['api_key'] } - resp = '&'.join(['%s=%s' % (k, v) for k, v in resp_data.items()]) + resp = '&'.join(['%s=%s' % (k.decode("utf-8"), v.decode("utf-8")) for k, v in resp_data.items()]) return bytes(resp) return b'' From eb6ac68d5c8f323ef7036a4daf4e3cc0e55bfc85 Mon Sep 17 00:00:00 2001 From: Allan Simon Date: Fri, 31 Jan 2014 18:54:59 +0800 Subject: [PATCH 2/2] close #276, now we trigger 'groupchat_message_error' and muc::ROOM::message_error when we receive a message type=error from the server --- sleekxmpp/plugins/xep_0045.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sleekxmpp/plugins/xep_0045.py b/sleekxmpp/plugins/xep_0045.py index 6e3f10a9..9587fa1a 100644 --- a/sleekxmpp/plugins/xep_0045.py +++ b/sleekxmpp/plugins/xep_0045.py @@ -126,6 +126,7 @@ class XEP_0045(BasePlugin): # load MUC support in presence stanzas register_stanza_plugin(Presence, MUCPresence) self.xmpp.register_handler(Callback('MUCPresence', MatchXMLMask("" % self.xmpp.default_ns), self.handle_groupchat_presence)) + self.xmpp.register_handler(Callback('MUCError', MatchXMLMask("" % self.xmpp.default_ns), self.handle_groupchat_error_message)) self.xmpp.register_handler(Callback('MUCMessage', MatchXMLMask("" % self.xmpp.default_ns), self.handle_groupchat_message)) self.xmpp.register_handler(Callback('MUCSubject', MatchXMLMask("" % self.xmpp.default_ns), self.handle_groupchat_subject)) self.xmpp.register_handler(Callback('MUCConfig', MatchXMLMask("" % self.xmpp.default_ns), self.handle_config_change)) @@ -179,6 +180,14 @@ class XEP_0045(BasePlugin): self.xmpp.event('groupchat_message', msg) self.xmpp.event("muc::%s::message" % msg['from'].bare, msg) + def handle_groupchat_error_message(self, msg): + """ Handle a message error event in a muc. + """ + self.xmpp.event('groupchat_message_error', msg) + self.xmpp.event("muc::%s::message_error" % msg['from'].bare, msg) + + + def handle_groupchat_subject(self, msg): """ Handle a message coming from a muc indicating a change of subject (or announcing it when joining the room)