Mercurial > libervia-backend
changeset 3805:33ab258df0de
cli (message/retract): message retractation command:
rel 367
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 17 Jun 2022 14:15:23 +0200 |
parents | 36b167ddbfca |
children | adebd8036b68 |
files | sat_frontends/jp/cmd_message.py |
diffstat | 1 files changed, 28 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/sat_frontends/jp/cmd_message.py Fri Jun 17 14:15:23 2022 +0200 +++ b/sat_frontends/jp/cmd_message.py Fri Jun 17 14:15:23 2022 +0200 @@ -187,6 +187,33 @@ await self.sendStdin(jid_) +class Retract(base.CommandBase): + + def __init__(self, host): + super().__init__(host, "retract", help=_("retract a message")) + + def add_parser_options(self): + self.parser.add_argument( + "message_id", + help=_("ID of the message (internal ID)") + ) + + async def start(self): + try: + await self.host.bridge.messRetract( + self.args.message_id, + self.profile + ) + except Exception as e: + self.disp(f"can't retract message: {e}", error=True) + self.host.quit(C.EXIT_BRIDGE_ERRBACK) + else: + self.disp( + "message retraction has been requested, please note that this is a " + "request which can't be enforced (see documentation for details).") + self.host.quit(C.EXIT_OK) + + class MAM(base.CommandBase): def __init__(self, host): @@ -269,7 +296,7 @@ class Message(base.CommandBase): - subcommands = (Send, MAM) + subcommands = (Send, Retract, MAM) def __init__(self, host): super(Message, self).__init__(