From 3a8fef7b7b3c101c4bcb8cd3d7460a009c98a41e Mon Sep 17 00:00:00 2001 From: fiaxh Date: Tue, 21 Apr 2020 16:25:01 +0200 Subject: Improve message read markers for MUCs --- libdino/src/service/chat_interaction.vala | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'libdino/src/service') diff --git a/libdino/src/service/chat_interaction.vala b/libdino/src/service/chat_interaction.vala index 4ec8e243..1e86ccf4 100644 --- a/libdino/src/service/chat_interaction.vala +++ b/libdino/src/service/chat_interaction.vala @@ -131,7 +131,7 @@ public class ChatInteraction : StreamInteractionModule, Object { } private void check_send_read() { - if (selected_conversation == null || selected_conversation.type_ == Conversation.Type.GROUPCHAT) return; + if (selected_conversation == null) return; Entities.Message? message = stream_interactor.get_module(MessageStorage.IDENTITY).get_last_message(selected_conversation); if (message != null && message.direction == Entities.Message.DIRECTION_RECEIVED && !message.equals(selected_conversation.read_up_to)) { selected_conversation.read_up_to = message; @@ -197,17 +197,22 @@ public class ChatInteraction : StreamInteractionModule, Object { XmppStream? stream = stream_interactor.get_stream(conversation.account); if (stream == null) return; - if (message.stanza_id == null) return; // Need a stanza id to mark - switch (marker) { case Xep.ChatMarkers.MARKER_RECEIVED: - if (stanza != null && Xep.ChatMarkers.Module.requests_marking(stanza)) { + if (stanza != null && Xep.ChatMarkers.Module.requests_marking(stanza) && message.type_ != Message.Type.GROUPCHAT) { + if (message.stanza_id == null) return; stream.get_module(Xep.ChatMarkers.Module.IDENTITY).send_marker(stream, message.from, message.stanza_id, message.get_type_string(), Xep.ChatMarkers.MARKER_RECEIVED); } break; case Xep.ChatMarkers.MARKER_DISPLAYED: if (conversation.get_send_marker_setting(stream_interactor) == Conversation.Setting.ON) { - stream.get_module(Xep.ChatMarkers.Module.IDENTITY).send_marker(stream, message.from, message.stanza_id, message.get_type_string(), Xep.ChatMarkers.MARKER_DISPLAYED); + if (message.type_ == Message.Type.GROUPCHAT) { + if (message.stanza_id == null) return; + stream.get_module(Xep.ChatMarkers.Module.IDENTITY).send_marker(stream, message.from.bare_jid, message.server_id, message.get_type_string(), Xep.ChatMarkers.MARKER_DISPLAYED); + } else { + if (message.stanza_id == null) return; + stream.get_module(Xep.ChatMarkers.Module.IDENTITY).send_marker(stream, message.from, message.stanza_id, message.get_type_string(), Xep.ChatMarkers.MARKER_DISPLAYED); + } } break; } -- cgit v1.2.3-70-g09d2