plugin XEP-0277: add a trigger to send method:
rel 370
This commit is contained in:
parent
6c170ef8cc
commit
38c5cc2fba
1 changed files with 8 additions and 0 deletions
|
|
@ -961,6 +961,8 @@ class XEP_0277(object):
|
||||||
"""
|
"""
|
||||||
# TODO: check that all data keys are used, this would avoid sending publicly a private message
|
# 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)
|
# 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:
|
if node is None:
|
||||||
node = NS_MICROBLOG
|
node = NS_MICROBLOG
|
||||||
|
|
||||||
|
|
@ -976,6 +978,12 @@ class XEP_0277(object):
|
||||||
except error.StanzaError:
|
except error.StanzaError:
|
||||||
log.warning("Can't create comments node for item {}".format(item_id))
|
log.warning("Can't create comments node for item {}".format(item_id))
|
||||||
item = await self.data2entry(client, data, item_id, service, node)
|
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])
|
await self._p.publish(client, service, node, [item])
|
||||||
return item_id
|
return item_id
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue