Skip to content
Snippets Groups Projects
Commit bb34535c authored by Daniel Brötzmann's avatar Daniel Brötzmann Committed by Philipp Hörist
Browse files

Fix Read Markers

parent 40c757fb
No related branches found
No related tags found
No related merge requests found
......@@ -920,6 +920,24 @@ def _on_message_textview_key_press_event(self, textview, event):
def _on_autoscroll_changed(self, _widget, autoscroll):
self._jump_to_end_button.toggle(not autoscroll)
if not autoscroll:
return
# Check for unread messages and sendXEP-0333 Send <displayed> marker
type_ = ['chat-message', 'private-chat-message']
jid = self.contact.jid
if self.is_groupchat:
type_ = ['group-chat-message']
jid = self.contact.jid.bare
if not app.events.remove_events(self.account,
jid,
types=type_):
# There were events to remove
self._client.get_module('ChatMarkers').send_displayed_marker(
self.contact,
self.last_msg_id,
self._type)
self.last_msg_id = None
def _on_jump_to_end(self, _button):
self.scroll_to_end(force=True)
......
......@@ -508,7 +508,8 @@ def _on_message_received(self, event):
correct_id=event.correct_id,
additional_data=event.additional_data)
self.conversation_view.set_read_marker(event.properties.id)
if kind == 'outgoing':
self.conversation_view.set_read_marker(event.properties.id)
def _on_message_error(self, event):
self.conversation_view.show_error(event.message_id, event.error)
......
......@@ -39,4 +39,5 @@ def __init__(self, account, contact):
def set_timestamp(self, timestamp):
self.timestamp = timestamp
self.changed()
self.set_no_show_all(False)
self.show_all()
......@@ -213,6 +213,8 @@ def _insert_message(self, message):
self.add(message)
self._add_date_row(message.timestamp)
self._check_for_merge(message)
if message.kind == 'incoming':
self.set_read_marker(None)
GLib.idle_add(message.queue_resize)
def _add_date_row(self, timestamp):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment