# HG changeset patch # User Goffi # Date 1658330393 -7200 # Node ID 37a1193d90dbd7336b4f35634025e0ebdc7a258f # Parent e417c478b48873fcf615969d4cf703764ba856d2 plugin XEP-0277: add a trigger to `send` method: rel 370 diff -r e417c478b488 -r 37a1193d90db sat/plugins/plugin_xep_0277.py --- 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