Mercurial > libervia-backend
changeset 3848:e9c380ef41c8
plugin XEP-0277: return ID of published item in `send` and bridge's `mbSend`
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 14 Jul 2022 12:55:30 +0200 (2022-07-14) |
parents | aaa4e7815ba8 |
children | bc24ce903835 |
files | sat/plugins/plugin_xep_0277.py |
diffstat | 1 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/sat/plugins/plugin_xep_0277.py Thu Jul 14 12:55:30 2022 +0200 +++ b/sat/plugins/plugin_xep_0277.py Thu Jul 14 12:55:30 2022 +0200 @@ -109,7 +109,7 @@ "mbSend", ".plugin", in_sign="ssss", - out_sign="", + out_sign="s", method=self._mbSend, async_=True, ) @@ -948,7 +948,7 @@ 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 @@ 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 @@ 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,