comparison sat/plugins/plugin_xep_0329.py @ 3355:33d9b38b5890

plugin XEP-0329: better error handling in `onComponentAffiliationsGet`
author Goffi <goffi@goffi.org>
date Mon, 14 Sep 2020 09:23:23 +0200
parents ac9342f359e9
children 000b6722bd35
comparison
equal deleted inserted replaced
3354:aafb53248872 3355:33d9b38b5890
825 except RootPathException: 825 except RootPathException:
826 # if root path is requested, we only get owner affiliation 826 # if root path is requested, we only get owner affiliation
827 peer_jid, owner = self._compParseJids(client, iq_elt) 827 peer_jid, owner = self._compParseJids(client, iq_elt)
828 is_owner = peer_jid.userhostJID() == owner 828 is_owner = peer_jid.userhostJID() == owner
829 affiliations = {owner: 'owner'} 829 affiliations = {owner: 'owner'}
830 except exceptions.NotFound:
831 client.sendError(iq_elt, "item-not-found")
832 return
833 except Exception as e:
834 client.sendError(iq_elt, "internal-server-error", str(e))
835 return
830 else: 836 else:
831 from_jid_bare = from_jid.userhostJID() 837 from_jid_bare = from_jid.userhostJID()
832 is_owner = from_jid_bare == file_data.get('owner') 838 is_owner = from_jid_bare == file_data.get('owner')
833 affiliations = self.host.memory.getFileAffiliations(file_data) 839 affiliations = self.host.memory.getFileAffiliations(file_data)
834 iq_result_elt = xmlstream.toResponse(iq_elt, "result") 840 iq_result_elt = xmlstream.toResponse(iq_elt, "result")