changeset 3365:626046010a2d

plugin XEP-0329: fix filtering by owner on components
author Goffi <goffi@goffi.org>
date Sun, 20 Sep 2020 11:03:24 +0200 (2020-09-20)
parents d24252df91ee
children e09cb08166a3
files sat/plugins/plugin_xep_0329.py
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/sat/plugins/plugin_xep_0329.py	Thu Sep 17 23:07:12 2020 +0200
+++ b/sat/plugins/plugin_xep_0329.py	Sun Sep 20 11:03:24 2020 +0200
@@ -733,7 +733,7 @@
     # affiliations #
 
     async def _parseElement(self, client, iq_elt, element, namespace):
-        from_jid = jid.JID(iq_elt['from'])
+        peer_jid, owner = self._compParseJids(client, iq_elt)
         elt = next(iq_elt.elements(namespace, element))
         path = Path("/", elt['path'])
         if len(path.parts) < 2:
@@ -741,16 +741,17 @@
         namespace = elt.getAttribute('namespace')
         files_data = await self.host.memory.getFiles(
             client,
-            peer_jid=from_jid,
+            peer_jid=peer_jid,
             path=str(path.parent),
             name=path.name,
             namespace=namespace,
+            owner=owner,
         )
         if len(files_data) != 1:
             client.sendError(iq_elt, 'item-not-found')
             raise exceptions.CancelError
         file_data = files_data[0]
-        return from_jid, elt, path, namespace, file_data
+        return peer_jid, elt, path, namespace, file_data
 
     def _affiliationsGet(self, service_jid_s, namespace, path, profile):
         client = self.host.getClient(profile)