mirror of
https://github.com/markqvist/Sideband.git
synced 2025-01-11 23:49:48 -05:00
Added message markup rendering option to preferences
This commit is contained in:
parent
0573af2ba0
commit
79ba89373a
@ -3043,6 +3043,10 @@ class SidebandApp(MDApp):
|
||||
self.sideband.save_configuration()
|
||||
self.sideband.setstate("wants.viewupdate.conversations", True)
|
||||
|
||||
def save_trusted_markup_only(sender=None, event=None):
|
||||
self.sideband.config["trusted_markup_only"] = self.settings_screen.ids.settings_trusted_markup_only.active
|
||||
self.sideband.save_configuration()
|
||||
|
||||
def save_advanced_stats(sender=None, event=None):
|
||||
self.sideband.config["advanced_stats"] = self.settings_screen.ids.settings_advanced_statistics.active
|
||||
self.sideband.save_configuration()
|
||||
@ -3215,6 +3219,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.bind(active=save_lxmf_ignore_unknown)
|
||||
|
||||
self.settings_screen.ids.settings_trusted_markup_only.active = self.sideband.config["trusted_markup_only"]
|
||||
self.settings_screen.ids.settings_trusted_markup_only.bind(active=save_trusted_markup_only)
|
||||
|
||||
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)
|
||||
|
||||
|
@ -410,6 +410,7 @@ class SidebandCore():
|
||||
self.config["print_command"] = "lp"
|
||||
self.config["eink_mode"] = False
|
||||
self.config["lxm_limit_1mb"] = True
|
||||
self.config["trusted_markup_only"] = False
|
||||
|
||||
# Connectivity
|
||||
self.config["connect_transport"] = False
|
||||
@ -550,6 +551,8 @@ class SidebandCore():
|
||||
self.config["lxm_limit_1mb"] = True
|
||||
if not "hq_ptt" in self.config:
|
||||
self.config["hq_ptt"] = False
|
||||
if not "trusted_markup_only" in self.config:
|
||||
self.config["trusted_markup_only"] = False
|
||||
|
||||
if not "input_language" in self.config:
|
||||
self.config["input_language"] = None
|
||||
|
@ -133,6 +133,7 @@ class Conversations():
|
||||
unread = conv["unread"]
|
||||
last_activity = conv["last_activity"]
|
||||
trusted = conv["trust"] == 1
|
||||
appearance_from_all = self.app.sideband.config["display_style_from_all"]
|
||||
appearance = self.app.sideband.peer_appearance(context_dest, conv=conv)
|
||||
is_object = self.app.sideband.is_object(context_dest, conv_data=conv)
|
||||
da = self.app.sideband.DEFAULT_APPEARANCE
|
||||
@ -141,7 +142,7 @@ class Conversations():
|
||||
conv_icon = self.trust_icon(conv)
|
||||
fg = None; bg = None; ti_color = None
|
||||
|
||||
if trusted and self.app.sideband.config["display_style_in_contact_list"] and appearance != None and appearance != da:
|
||||
if (trusted or appearance_from_all) and self.app.sideband.config["display_style_in_contact_list"] and appearance != None and appearance != da:
|
||||
fg = appearance[1] or da[1]; bg = appearance[2] or da[2]
|
||||
ti_color = "Custom"
|
||||
else:
|
||||
|
@ -1624,6 +1624,22 @@ MDScreen:
|
||||
disabled: False
|
||||
active: False
|
||||
|
||||
MDBoxLayout:
|
||||
orientation: "horizontal"
|
||||
size_hint_y: None
|
||||
padding: [0,0,dp(24),dp(0)]
|
||||
height: dp(48)
|
||||
|
||||
MDLabel:
|
||||
text: "Only render markup from trusted"
|
||||
font_style: "H6"
|
||||
|
||||
MDSwitch:
|
||||
id: settings_trusted_markup_only
|
||||
pos_hint: {"center_y": 0.3}
|
||||
disabled: False
|
||||
active: False
|
||||
|
||||
MDBoxLayout:
|
||||
orientation: "horizontal"
|
||||
size_hint_y: None
|
||||
|
@ -378,7 +378,7 @@ class Messages():
|
||||
for m in self.new_messages:
|
||||
if not m["hash"] in self.added_item_hashes:
|
||||
try:
|
||||
if not self.is_trusted:
|
||||
if self.app.sideband.config["trusted_markup_only"] and not self.is_trusted:
|
||||
message_input = str( escape_markup(m["content"].decode("utf-8")) ).encode("utf-8")
|
||||
else:
|
||||
message_input = m["content"]
|
||||
|
Loading…
Reference in New Issue
Block a user