mirror of
https://github.com/liberatedsystems/openCom-Companion.git
synced 2024-11-22 05:20:36 +01:00
Added configuration option for ignoring messages with invalid stamps
This commit is contained in:
parent
c2881e70e9
commit
042726d27f
@ -2693,6 +2693,11 @@ class SidebandApp(MDApp):
|
|||||||
self.sideband.config["lxmf_ignore_unknown"] = self.settings_screen.ids.settings_lxmf_ignore_unknown.active
|
self.sideband.config["lxmf_ignore_unknown"] = self.settings_screen.ids.settings_lxmf_ignore_unknown.active
|
||||||
self.sideband.save_configuration()
|
self.sideband.save_configuration()
|
||||||
|
|
||||||
|
def save_lxmf_ignore_invalid_stamps(sender=None, event=None):
|
||||||
|
self.sideband.config["lxmf_ignore_invalid_stamps"] = self.settings_screen.ids.settings_ignore_invalid_stamps.active
|
||||||
|
self.sideband.save_configuration()
|
||||||
|
self.sideband.update_ignore_invalid_stamps()
|
||||||
|
|
||||||
def save_lxmf_sync_limit(sender=None, event=None):
|
def save_lxmf_sync_limit(sender=None, event=None):
|
||||||
self.sideband.config["lxmf_sync_limit"] = self.settings_screen.ids.settings_lxmf_sync_limit.active
|
self.sideband.config["lxmf_sync_limit"] = self.settings_screen.ids.settings_lxmf_sync_limit.active
|
||||||
self.sideband.save_configuration()
|
self.sideband.save_configuration()
|
||||||
@ -2762,7 +2767,7 @@ class SidebandApp(MDApp):
|
|||||||
slider_val = int(self.settings_screen.ids.settings_lxmf_require_stamps_cost.value)
|
slider_val = int(self.settings_screen.ids.settings_lxmf_require_stamps_cost.value)
|
||||||
cost_text = str(slider_val)
|
cost_text = str(slider_val)
|
||||||
|
|
||||||
self.settings_screen.ids.settings_lxmf_require_stamps_label.text = f"Require stamp cost {cost_text} for inbound messages"
|
self.settings_screen.ids.settings_lxmf_require_stamps_label.text = f"Require stamp cost {cost_text} for incoming messages"
|
||||||
if save:
|
if save:
|
||||||
if slider_val > 32:
|
if slider_val > 32:
|
||||||
slider_val = 32
|
slider_val = 32
|
||||||
@ -2826,6 +2831,9 @@ class SidebandApp(MDApp):
|
|||||||
self.settings_screen.ids.settings_lxmf_ignore_unknown.active = self.sideband.config["lxmf_ignore_unknown"]
|
self.settings_screen.ids.settings_lxmf_ignore_unknown.active = self.sideband.config["lxmf_ignore_unknown"]
|
||||||
self.settings_screen.ids.settings_lxmf_ignore_unknown.bind(active=save_lxmf_ignore_unknown)
|
self.settings_screen.ids.settings_lxmf_ignore_unknown.bind(active=save_lxmf_ignore_unknown)
|
||||||
|
|
||||||
|
self.settings_screen.ids.settings_ignore_invalid_stamps.active = self.sideband.config["lxmf_ignore_invalid_stamps"]
|
||||||
|
self.settings_screen.ids.settings_ignore_invalid_stamps.bind(active=save_lxmf_ignore_invalid_stamps)
|
||||||
|
|
||||||
self.settings_screen.ids.settings_lxmf_periodic_sync.active = self.sideband.config["lxmf_periodic_sync"]
|
self.settings_screen.ids.settings_lxmf_periodic_sync.active = self.sideband.config["lxmf_periodic_sync"]
|
||||||
self.settings_screen.ids.settings_lxmf_periodic_sync.bind(active=save_lxmf_periodic_sync)
|
self.settings_screen.ids.settings_lxmf_periodic_sync.bind(active=save_lxmf_periodic_sync)
|
||||||
save_lxmf_periodic_sync(save=False)
|
save_lxmf_periodic_sync(save=False)
|
||||||
|
@ -508,6 +508,8 @@ class SidebandCore():
|
|||||||
self.config["lxmf_try_propagation_on_fail"] = True
|
self.config["lxmf_try_propagation_on_fail"] = True
|
||||||
if not "lxmf_require_stamps" in self.config:
|
if not "lxmf_require_stamps" in self.config:
|
||||||
self.config["lxmf_require_stamps"] = False
|
self.config["lxmf_require_stamps"] = False
|
||||||
|
if not "lxmf_ignore_invalid_stamps" in self.config:
|
||||||
|
self.config["lxmf_ignore_invalid_stamps"] = True
|
||||||
if not "lxmf_inbound_stamp_cost" in self.config:
|
if not "lxmf_inbound_stamp_cost" in self.config:
|
||||||
self.config["lxmf_inbound_stamp_cost"] = None
|
self.config["lxmf_inbound_stamp_cost"] = None
|
||||||
if not "notifications_on" in self.config:
|
if not "notifications_on" in self.config:
|
||||||
@ -746,6 +748,7 @@ class SidebandCore():
|
|||||||
if unpacked_config != None and len(unpacked_config) != 0:
|
if unpacked_config != None and len(unpacked_config) != 0:
|
||||||
self.config = unpacked_config
|
self.config = unpacked_config
|
||||||
self.update_active_lxmf_propagation_node()
|
self.update_active_lxmf_propagation_node()
|
||||||
|
self.update_ignore_invalid_stamps()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
RNS.log("Error while reloading configuration: "+str(e), RNS.LOG_ERROR)
|
RNS.log("Error while reloading configuration: "+str(e), RNS.LOG_ERROR)
|
||||||
|
|
||||||
@ -3674,6 +3677,10 @@ class SidebandCore():
|
|||||||
configured_stamp_cost = self.config["lxmf_inbound_stamp_cost"]
|
configured_stamp_cost = self.config["lxmf_inbound_stamp_cost"]
|
||||||
|
|
||||||
self.lxmf_destination = self.message_router.register_delivery_identity(self.identity, display_name=self.config["display_name"], stamp_cost=configured_stamp_cost)
|
self.lxmf_destination = self.message_router.register_delivery_identity(self.identity, display_name=self.config["display_name"], stamp_cost=configured_stamp_cost)
|
||||||
|
if self.config["lxmf_ignore_invalid_stamps"]:
|
||||||
|
self.message_router.enforce_stamps()
|
||||||
|
else:
|
||||||
|
self.message_router.ignore_stamps()
|
||||||
|
|
||||||
# TODO: Update to announce call in LXMF when full 0.5.0 support is added (get app data from LXMRouter instead)
|
# TODO: Update to announce call in LXMF when full 0.5.0 support is added (get app data from LXMRouter instead)
|
||||||
# Currently overrides the LXMF routers auto-generated announce data so that Sideband will announce old-format
|
# Currently overrides the LXMF routers auto-generated announce data so that Sideband will announce old-format
|
||||||
@ -3694,6 +3701,12 @@ class SidebandCore():
|
|||||||
else:
|
else:
|
||||||
self.set_active_propagation_node(None)
|
self.set_active_propagation_node(None)
|
||||||
|
|
||||||
|
def update_ignore_invalid_stamps(self):
|
||||||
|
if self.config["lxmf_ignore_invalid_stamps"]:
|
||||||
|
self.message_router.enforce_stamps()
|
||||||
|
else:
|
||||||
|
self.message_router.ignore_stamps()
|
||||||
|
|
||||||
def message_notification_no_display(self, message):
|
def message_notification_no_display(self, message):
|
||||||
self.message_notification(message, no_display=True)
|
self.message_notification(message, no_display=True)
|
||||||
|
|
||||||
|
@ -1611,7 +1611,7 @@ MDScreen:
|
|||||||
|
|
||||||
MDLabel:
|
MDLabel:
|
||||||
id: settings_lxmf_require_stamps_label
|
id: settings_lxmf_require_stamps_label
|
||||||
text: "Require stamps for inbound messages"
|
text: "Require stamps for incoming"
|
||||||
font_style: "H6"
|
font_style: "H6"
|
||||||
|
|
||||||
MDSwitch:
|
MDSwitch:
|
||||||
@ -1635,6 +1635,22 @@ MDScreen:
|
|||||||
sensitivity: "all"
|
sensitivity: "all"
|
||||||
hint: False
|
hint: False
|
||||||
|
|
||||||
|
MDBoxLayout:
|
||||||
|
orientation: "horizontal"
|
||||||
|
size_hint_y: None
|
||||||
|
padding: [0,0,dp(24),dp(0)]
|
||||||
|
height: dp(48)
|
||||||
|
|
||||||
|
MDLabel:
|
||||||
|
text: "Ignore messages with invalid stamps"
|
||||||
|
font_style: "H6"
|
||||||
|
|
||||||
|
MDSwitch:
|
||||||
|
id: settings_ignore_invalid_stamps
|
||||||
|
pos_hint: {"center_y": 0.3}
|
||||||
|
disabled: False
|
||||||
|
active: False
|
||||||
|
|
||||||
MDBoxLayout:
|
MDBoxLayout:
|
||||||
orientation: "horizontal"
|
orientation: "horizontal"
|
||||||
size_hint_y: None
|
size_hint_y: None
|
||||||
|
@ -152,8 +152,12 @@ class Messages():
|
|||||||
valid_str = " is valid"
|
valid_str = " is valid"
|
||||||
sv = msg["extras"]["stamp_value"]
|
sv = msg["extras"]["stamp_value"]
|
||||||
if sv == None:
|
if sv == None:
|
||||||
sv_str = "was not included in the message"
|
if "stamp_raw" in msg["extras"]:
|
||||||
valid_str = ""
|
sv_str = ""
|
||||||
|
valid_str = "is not valid"
|
||||||
|
else:
|
||||||
|
sv_str = ""
|
||||||
|
valid_str = "was not included in the message"
|
||||||
elif sv > 255:
|
elif sv > 255:
|
||||||
sv_str = "generated from ticket"
|
sv_str = "generated from ticket"
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user