From 6b12bc7982bd5834b50c4662cd02393ccf8a04db Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Tue, 31 Oct 2023 22:29:07 +0100 Subject: [PATCH] Tweaked signature warning display --- sbapp/sideband/core.py | 2 +- sbapp/ui/conversations.py | 2 -- sbapp/ui/messages.py | 11 +++++++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/sbapp/sideband/core.py b/sbapp/sideband/core.py index 6af0455..3891351 100644 --- a/sbapp/sideband/core.py +++ b/sbapp/sideband/core.py @@ -681,7 +681,7 @@ class SidebandCore(): try: if app_data == None: app_data = b"" - RNS.log("Received "+str(dest_type)+" announce for "+RNS.prettyhexrep(dest)+" with data: "+app_data.decode("utf-8")) + RNS.log("Received "+str(dest_type)+" announce for "+RNS.prettyhexrep(dest)+" with data: "+app_data.decode("utf-8"), RNS.LOG_DEBUG) self._db_save_announce(dest, app_data, dest_type) self.setstate("app.flags.new_announces", True) diff --git a/sbapp/ui/conversations.py b/sbapp/ui/conversations.py index 9c689ed..a0822fa 100644 --- a/sbapp/ui/conversations.py +++ b/sbapp/ui/conversations.py @@ -39,8 +39,6 @@ class Conversations(): self.ids = None if not self.app.root.ids.screen_manager.has_screen("conversations_screen"): - # TODO: Remove - RNS.log("Adding conversations screen", RNS.LOG_WARNING) self.screen = Builder.load_string(conv_screen_kv) self.screen.app = self.app self.ids = self.screen.ids diff --git a/sbapp/ui/messages.py b/sbapp/ui/messages.py index 4f0eab9..e240301 100644 --- a/sbapp/ui/messages.py +++ b/sbapp/ui/messages.py @@ -293,8 +293,15 @@ class Messages(): heading_str += rcvd_d_str pre_content = "" + force_markup = False if not signature_valid: - pre_content += "[b]Warning![/b] The signature for this message could not be validated. Check that you have received an announce from this sender. If you already have, or other messages from the sender do not display this warning, [b]this message is likely to be fake[/b].\n\n" + identity_known = False + if RNS.Identity.recall(m["hash"]) != None: + identity_known = True + + if identity_known == True: + pre_content += "[b]Warning![/b] The signature for this message could not be validated. [b]This message is likely to be fake[/b].\n\n" + force_markup = True item = ListLXMessageCard( text=pre_content+m["content"].decode("utf-8")+extra_content, @@ -312,7 +319,7 @@ class Messages(): item.ids.content_text.text_color = mt_color item.ids.msg_submenu.theme_text_color = "Custom" item.ids.msg_submenu.text_color = mt_color - item.ids.content_text.markup = self.is_trusted + item.ids.content_text.markup = self.is_trusted or force_markup def gen_del(mhash, item): def x():