Notification logic

This commit is contained in:
Mark Qvist 2022-10-02 12:15:37 +02:00
parent 93d214ead6
commit a74e0f9cf7
3 changed files with 13 additions and 3 deletions

View file

@ -1096,9 +1096,6 @@ class SidebandCore():
context_dest = message.source_hash
is_trusted = self.is_trusted(context_dest)
if is_trusted:
should_notify = True
if self._db_message(message.hash):
RNS.log("Message exists, setting state to: "+str(message.state), RNS.LOG_DEBUG)
self._db_message_set_state(message.hash, message.state)
@ -1106,6 +1103,9 @@ class SidebandCore():
RNS.log("Message does not exist, saving", RNS.LOG_DEBUG)
self._db_save_lxm(message, context_dest)
if is_trusted:
should_notify = True
if self._db_conversation(context_dest) == None:
self._db_create_conversation(context_dest)
self.setstate("app.flags.new_conversations", True)
@ -1121,6 +1121,9 @@ class SidebandCore():
self.unread_conversation(context_dest)
self.setstate("app.flags.unread_conversations", True)
if self.gui_display() == "conversations_screen" and self.gui_foreground():
should_notify = False
if self.is_client:
should_notify = False