# HG changeset patch # User Goffi # Date 1655468123 -7200 # Node ID 33ab258df0de3193c45596cdb2a6bbcada25e4ba # Parent 36b167ddbfcaaca9122c27e06e834b84619b13b6 cli (message/retract): message retractation command: rel 367 diff -r 36b167ddbfca -r 33ab258df0de sat_frontends/jp/cmd_message.py --- 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__(