diff src/plugins/plugin_xep_0329.py @ 2528:65e278997715

component file sharing: comments metadata: new <comments> element is added to file metadata, it contains the URL to the comments virtual node and the count of comments (this way client knows if it make sense to request comments or not). Fixed triggers in plugin XEP-0264 (return value was missing). New trigger in plugin XEP-0329 to allow component to add metadata (used here for comments url).
author Goffi <goffi@goffi.org>
date Fri, 16 Mar 2018 18:43:11 +0100
parents a201194fc461
children 8d82a62fa098
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0329.py	Fri Mar 16 17:06:35 2018 +0100
+++ b/src/plugins/plugin_xep_0329.py	Fri Mar 16 18:43:11 2018 +0100
@@ -423,6 +423,11 @@
 
     @defer.inlineCallbacks
     def _compGetFilesFromNodeCb(self, client, iq_elt, owner, node_path):
+        """retrieve files from local files repository according to permissions
+
+        result stanza is then built and sent to requestor
+        @trigger XEP-0329_compGetFilesFromNode(client, iq_elt, owner, node_path, files_data): can be used to add data/elements
+        """
         peer_jid = jid.JID(iq_elt['from'])
         try:
             files_data = yield self.host.memory.getFiles(client, peer_jid=peer_jid, path=node_path, owner=owner)
@@ -432,6 +437,8 @@
         iq_result_elt = xmlstream.toResponse(iq_elt, 'result')
         query_elt = iq_result_elt.addElement((NS_FIS, 'query'))
         query_elt[u'node'] = node_path
+        if not self.host.trigger.point(u'XEP-0329_compGetFilesFromNode', client, iq_elt, owner, node_path, files_data):
+            return
         for file_data in files_data:
             file_elt = self._jf.buildFileElementFromDict(file_data,
                                                          modified=file_data.get(u'modified', file_data[u'created']))