From d04ba950d3a42dec384e8222c1edd037522ec646 Mon Sep 17 00:00:00 2001 From: Goffi Date: Mon, 17 Apr 2017 20:31:12 +0200 Subject: [PATCH] plugin XEP-0060: getNodeAffiliations use jid.JID as keys instead of jids as unicode --- src/plugins/plugin_xep_0060.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/plugin_xep_0060.py b/src/plugins/plugin_xep_0060.py index e6f0ea6e..167f5696 100755 --- a/src/plugins/plugin_xep_0060.py +++ b/src/plugins/plugin_xep_0060.py @@ -483,6 +483,7 @@ class XEP_0060(object): def _getNodeAffiliations(self, service_s, nodeIdentifier, profile_key): client = self.host.getClient(profile_key) d = self.getNodeAffiliations(client, jid.JID(service_s) if service_s else None, nodeIdentifier) + d.addCallback(lambda affiliations: {j.full(): a for j, a in affiliations.iteritems()}) return d def getNodeAffiliations(self, client, service, nodeIdentifier): @@ -497,7 +498,7 @@ class XEP_0060(object): except StopIteration: raise ValueError(_(u"Invalid result: missing element: {}").format(iq_elt.toXml)) try: - return {e['jid']: e['affiliation'] for e in affiliations_elt.elements((pubsub.NS_PUBSUB_OWNER, 'affiliation'))} + return {jid.JID(e['jid']): e['affiliation'] for e in affiliations_elt.elements((pubsub.NS_PUBSUB_OWNER, 'affiliation'))} except KeyError: raise ValueError(_(u"Invalid result: bad element: {}").format(iq_elt.toXml))