From 3a59723e1f9951c1b2ffbd6c87cbed0f2e2ca1c6 Mon Sep 17 00:00:00 2001 From: liamcottle Date: Sun, 28 Jul 2024 14:53:03 +1200 Subject: [PATCH] add setting to prevent auto resending failed messages with attachments --- meshchat.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/meshchat.py b/meshchat.py index ecbbae8..1f5c8e9 100644 --- a/meshchat.py +++ b/meshchat.py @@ -1701,6 +1701,12 @@ class ReticulumMeshChat: file_attachments.append(LxmfFileAttachment(file_attachment["file_name"], base64.b64decode(file_attachment["file_bytes"]))) file_attachments_field = LxmfFileAttachmentsField(file_attachments) + # don't resend message with attachments if not allowed + if not self.config.allow_auto_resending_failed_messages_with_attachments.get(): + if image_field is not None or audio_field is not None or file_attachments_field is not None: + print("Not resending failed message with attachments, as setting is disabled") + continue + # send new message with failed message content await self.send_message( failed_message.destination_hash, @@ -1890,6 +1896,7 @@ class Config: auto_announce_interval_seconds = IntConfig("auto_announce_interval_seconds", 0) last_announced_at = IntConfig("last_announced_at", None) auto_resend_failed_messages_when_announce_received = BoolConfig("auto_resend_failed_messages_when_announce_received", True) + allow_auto_resending_failed_messages_with_attachments = BoolConfig("allow_auto_resending_failed_messages_with_attachments", False) # an announce handler for lxmf.delivery aspect that just forwards to a provided callback