Commit da232c8a authored by Tijmen de Mes's avatar Tijmen de Mes

Don't send IMDN for outgoing messages

parent d5d21397
...@@ -2426,7 +2426,7 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin): ...@@ -2426,7 +2426,7 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin):
else: else:
self.render_after_load.append(ChatMessage(content, sender, direction, id=message.id)) self.render_after_load.append(ChatMessage(content, sender, direction, id=message.id))
if message.disposition is not None and 'display' in message.disposition and not encrypted: if direction != 'outgoing' and message.disposition is not None and 'display' in message.disposition and not encrypted:
if self.selected_session.blink_session is blink_session and not self.isMinimized() and self.isActiveWindow(): if self.selected_session.blink_session is blink_session and not self.isMinimized() and self.isActiveWindow():
MessageManager().send_imdn_message(blink_session, message.id, message.timestamp, 'displayed', account) MessageManager().send_imdn_message(blink_session, message.id, message.timestamp, 'displayed', account)
else: else:
...@@ -2496,7 +2496,7 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin): ...@@ -2496,7 +2496,7 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin):
account_manager = AccountManager() account_manager = AccountManager()
account = account_manager.get_account(message.account_id) if account_manager.has_account(message.account_id) else None account = account_manager.get_account(message.account_id) if account_manager.has_account(message.account_id) else None
if message.state != 'displayed' and 'display' in message.disposition: if message.direction != 'outgoing' and message.state != 'displayed' and 'display' in message.disposition:
if message.state != 'delivered' and 'positive-delivery' in message.disposition: if message.state != 'delivered' and 'positive-delivery' in message.disposition:
MessageManager().send_imdn_message(blink_session, message.message_id, message.timestamp, 'delivered', account) MessageManager().send_imdn_message(blink_session, message.message_id, message.timestamp, 'delivered', account)
......
...@@ -434,8 +434,12 @@ class MessageHistory(object, metaclass=Singleton): ...@@ -434,8 +434,12 @@ class MessageHistory(object, metaclass=Singleton):
except IndexError: except IndexError:
pass pass
else: else:
# print(f'-- Updating {id} {message.state} -> {state}') if message.direction == 'outgoing' and state == 'received':
message.state = state return
if message.state != 'displayed' and message.state != state:
# print(f'-- Updating {message.direction} {id} {message.state} -> {state}')
message.state = state
@run_in_thread('db') @run_in_thread('db')
def update_encryption(self, notification): def update_encryption(self, notification):
......
...@@ -333,7 +333,7 @@ class OutgoingMessage(object): ...@@ -333,7 +333,7 @@ class OutgoingMessage(object):
@property @property
def message(self): def message(self):
return BlinkMessage(self.content, self.content_type, self.account, timestamp=self.timestamp, id=self.id, is_secure=self.is_secure) return BlinkMessage(self.content, self.content_type, self.account, timestamp=self.timestamp, id=self.id, is_secure=self.is_secure, direction='outgoing')
def _lookup(self): def _lookup(self):
settings = SIPSimpleSettings() settings = SIPSimpleSettings()
...@@ -581,7 +581,7 @@ class MessageManager(object, metaclass=Singleton): ...@@ -581,7 +581,7 @@ class MessageManager(object, metaclass=Singleton):
if account is session.account: if account is session.account:
notification_center.post_notification('BlinkMessageIsParsed', sender=session, data=message) notification_center.post_notification('BlinkMessageIsParsed', sender=session, data=message)
if message is not None and 'positive-delivery' in message.disposition: if message is not None and message.direction != 'outgoing' and 'positive-delivery' in message.disposition:
print("-- Should send delivered imdn") print("-- Should send delivered imdn")
self.send_imdn_message(session, message.id, message.timestamp, 'delivered') self.send_imdn_message(session, message.id, message.timestamp, 'delivered')
...@@ -902,9 +902,17 @@ class MessageManager(object, metaclass=Singleton): ...@@ -902,9 +902,17 @@ class MessageManager(object, metaclass=Singleton):
def _NH_PGPMessageDidNotDecrypt(self, notification): def _NH_PGPMessageDidNotDecrypt(self, notification):
session = notification.sender session = notification.sender
data = notification.data.message message = notification.data.message
self.send_imdn_message(session, data.message_id, data.timestamp, 'error') if message.direction == 'outgoing':
return
try:
msg_id = message.message_id
except AttributeError:
msg_id = message.id
self.send_imdn_message(session, msg_id, message.timestamp, 'error')
def export_private_key(self, account): def export_private_key(self, account):
if account is None: if account is None:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment