plugin XEP-0277: return ID of published item in send and bridge's mbSend

This commit is contained in:
Goffi 2022-07-14 12:55:30 +02:00
commit c7945a0ed6

View file

@ -109,7 +109,7 @@ class XEP_0277(object):
"mbSend",
".plugin",
in_sign="ssss",
out_sign="",
out_sign="s",
method=self._mbSend,
async_=True,
)
@ -948,7 +948,7 @@ class XEP_0277(object):
data: dict,
service: Optional[jid.JID] = None,
node: Optional[str] = NS_MICROBLOG
) -> None:
) -> Optional[str]:
"""Send XEP-0277's microblog data
@param data: microblog data (must include at least a "content" or a "title" key).
@ -957,6 +957,7 @@ class XEP_0277(object):
None to publish on profile's PEP
@param node: PubSub node to use (defaut to microblog NS)
None is equivalend as using default value
@return: ID of the published item
"""
# 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)
@ -975,7 +976,8 @@ 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)
return await self._p.publish(client, service, node, [item])
await self._p.publish(client, service, node, [item])
return item_id
def _mbRepeat(
self,