plugin XEP-0277: add a trigger to send method:

rel 370
This commit is contained in:
Goffi 2022-07-20 17:19:53 +02:00
commit 38c5cc2fba

View file

@ -961,6 +961,8 @@ class XEP_0277(object):
"""
# 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 @@ class XEP_0277(object):
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