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

Changed got message event to allow for more arguments

parent 4b03268b
......@@ -2380,12 +2380,12 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin):
def _NH_BlinkGotMessage(self, notification):
blink_session = notification.sender
session = blink_session.items.chat
message = notification.data
if session is None:
return
message = notification.data.message
direction = notification.data.message.direction
encrypted = False
if message.content_type.startswith('image/'):
content = '''<img src="data:{};base64,{}" class="scaled-to-fit" />'''.format(message.content_type, message.content.decode('base64').rstrip())
......@@ -2421,10 +2421,10 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin):
self.pending_decryption.remove(message)
session.chat_widget.update_message_text(message.id, content)
else:
session.chat_widget.add_message(ChatMessage(content, sender, 'incoming', id=message.id))
session.chat_widget.add_message(ChatMessage(content, sender, direction, id=message.id))
session.chat_widget.update_message_encryption(message.id, message.is_secure)
else:
self.render_after_load.append(ChatMessage(content, sender, 'incoming', 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 self.selected_session.blink_session is blink_session and not self.isMinimized() and self.isActiveWindow():
......
......@@ -585,8 +585,8 @@ class MessageManager(object, metaclass=Singleton):
print("-- Should send delivered imdn")
self.send_imdn_message(session, message.id, message.timestamp, 'delivered')
notification_center.post_notification('BlinkGotMessage', sender=session, data=message)
self._add_contact_to_messages_group(session.account, session.contact)
notification_center.post_notification('BlinkGotMessage', sender=session, data=NotificationData(message=message))
def _send_message(self, outgoing_message):
self._outgoing_message_queue.append(outgoing_message)
......@@ -846,7 +846,7 @@ class MessageManager(object, metaclass=Singleton):
self._add_contact_to_messages_group(blink_session.account, blink_session.contact)
notification_center.post_notification('BlinkGotMessage',
sender=blink_session,
data=message)
data=NotificationData(message=message))
return
self._handle_incoming_message(message, blink_session, account)
......
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