changeset 3861:37a1193d90db

plugin XEP-0277: add a trigger to `send` method: rel 370
author Goffi <goffi@goffi.org>
date Wed, 20 Jul 2022 17:19:53 +0200
parents e417c478b488
children 100dd30244c6
files sat/plugins/plugin_xep_0277.py
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/sat/plugins/plugin_xep_0277.py	Wed Jul 20 17:18:17 2022 +0200
+++ b/sat/plugins/plugin_xep_0277.py	Wed Jul 20 17:19:53 2022 +0200
@@ -961,6 +961,8 @@
         """
         # TODO: check that all data keys are used, this would avoid sending publicly a private message
         #       by accident (e.g. if group plugin is not loaded, and "group*" key are not used)
+        if service is None:
+            service = client.jid.userhostJID()
         if node is None:
             node = NS_MICROBLOG
 
@@ -976,6 +978,12 @@
         except error.StanzaError:
             log.warning("Can't create comments node for item {}".format(item_id))
         item = await self.data2entry(client, data, item_id, service, node)
+
+        if not await self.host.trigger.asyncPoint(
+            "XEP-0277_send", client, service, node, item, data
+        ):
+            return None
+
         await self._p.publish(client, service, node, [item])
         return item_id