mirror of
https://github.com/liberatedsystems/Sideband_CE.git
synced 2024-09-03 04:13:27 +02:00
Added ability to ignore unknown senders
This commit is contained in:
parent
26aa9dc1bf
commit
ce9f9f42d7
@ -1258,6 +1258,10 @@ class SidebandApp(MDApp):
|
||||
self.sideband.config["propagation_by_default"] = self.root.ids.settings_lxmf_delivery_by_default.active
|
||||
self.sideband.save_configuration()
|
||||
|
||||
def save_lxmf_ignore_unknown(sender=None, event=None):
|
||||
self.sideband.config["lxmf_ignore_unknown"] = self.root.ids.settings_lxmf_ignore_unknown.active
|
||||
self.sideband.save_configuration()
|
||||
|
||||
def save_lxmf_sync_limit(sender=None, event=None):
|
||||
self.sideband.config["lxmf_sync_limit"] = self.root.ids.settings_lxmf_sync_limit.active
|
||||
self.sideband.save_configuration()
|
||||
@ -1333,6 +1337,9 @@ class SidebandApp(MDApp):
|
||||
self.root.ids.settings_lxmf_delivery_by_default.active = self.sideband.config["propagation_by_default"]
|
||||
self.root.ids.settings_lxmf_delivery_by_default.bind(active=save_lxmf_delivery_by_default)
|
||||
|
||||
self.root.ids.settings_lxmf_ignore_unknown.active = self.sideband.config["lxmf_ignore_unknown"]
|
||||
self.root.ids.settings_lxmf_ignore_unknown.bind(active=save_lxmf_ignore_unknown)
|
||||
|
||||
self.root.ids.settings_lxmf_periodic_sync.active = self.sideband.config["lxmf_periodic_sync"]
|
||||
self.root.ids.settings_lxmf_periodic_sync.bind(active=save_lxmf_periodic_sync)
|
||||
save_lxmf_periodic_sync(save=False)
|
||||
|
@ -321,6 +321,8 @@ class SidebandCore():
|
||||
self.config["dark_ui"] = True
|
||||
if not "lxmf_periodic_sync" in self.config:
|
||||
self.config["lxmf_periodic_sync"] = False
|
||||
if not "lxmf_ignore_unknown" in self.config:
|
||||
self.config["lxmf_ignore_unknown"] = False
|
||||
if not "lxmf_sync_interval" in self.config:
|
||||
self.config["lxmf_sync_interval"] = 43200
|
||||
if not "notifications_on" in self.config:
|
||||
@ -2148,6 +2150,12 @@ class SidebandCore():
|
||||
RNS.log("LXMF delivery "+str(time_string)+". "+str(signature_string)+".")
|
||||
|
||||
try:
|
||||
if self.config["lxmf_ignore_unknown"] == True:
|
||||
context_dest = message.source_hash
|
||||
if self._db_conversation(context_dest) == None:
|
||||
RNS.log("Dropping message from unknown sender "+RNS.prettyhexrep(context_dest), RNS.LOG_DEBUG)
|
||||
return
|
||||
|
||||
self.lxm_ingest(message)
|
||||
except Exception as e:
|
||||
RNS.log("Error while ingesting LXMF message "+RNS.prettyhexrep(message.hash)+" to database: "+str(e))
|
||||
|
@ -1111,6 +1111,22 @@ MDNavigationLayout:
|
||||
disabled: False
|
||||
active: False
|
||||
|
||||
MDBoxLayout:
|
||||
orientation: "horizontal"
|
||||
size_hint_y: None
|
||||
padding: [0,0,dp(24),dp(0)]
|
||||
height: dp(48)
|
||||
|
||||
MDLabel:
|
||||
text: "Ignore unknown senders"
|
||||
font_style: "H6"
|
||||
|
||||
MDSwitch:
|
||||
id: settings_lxmf_ignore_unknown
|
||||
pos_hint: {"center_y": 0.3}
|
||||
disabled: False
|
||||
active: False
|
||||
|
||||
MDBoxLayout:
|
||||
orientation: "horizontal"
|
||||
size_hint_y: None
|
||||
|
Loading…
Reference in New Issue
Block a user