ignore lxmf messages if they are telemetry requests from sideband

This commit is contained in:
liamcottle
2025-01-05 23:22:20 +13:00
parent 48e56e5285
commit 6b4bf0e31a
2 changed files with 17 additions and 0 deletions

View File

@@ -27,6 +27,7 @@ from src.backend.colour_utils import ColourUtils
from src.backend.interface_config_parser import InterfaceConfigParser
from src.backend.lxmf_message_fields import LxmfImageField, LxmfFileAttachmentsField, LxmfFileAttachment, LxmfAudioField
from src.backend.audio_call_manager import AudioCall, AudioCallManager
from src.backend.sideband_commands import SidebandCommands
# NOTE: this is required to be able to pack our app with cxfreeze as an exe, otherwise it can't access bundled assets
@@ -2327,6 +2328,19 @@ class ReticulumMeshChat:
def on_lxmf_delivery(self, lxmf_message: LXMF.LXMessage):
try:
# check if this lxmf message contains a telemetry request command from sideband
is_sideband_telemetry_request = False
lxmf_fields = lxmf_message.get_fields()
if LXMF.FIELD_COMMANDS in lxmf_fields:
for command in lxmf_fields[LXMF.FIELD_COMMANDS]:
if SidebandCommands.TELEMETRY_REQUEST in command:
is_sideband_telemetry_request = True
# ignore telemetry requests from sideband
if is_sideband_telemetry_request:
print("Ignoring received LXMF message as it is a telemetry request command")
return
# upsert lxmf message to database
self.db_upsert_lxmf_message(lxmf_message)

View File

@@ -0,0 +1,3 @@
# https://github.com/markqvist/Sideband/blob/e515889e210037f881c201e0d627a7b09a48eb69/sbapp/sideband/sense.py#L11
class SidebandCommands:
TELEMETRY_REQUEST = 0x01