aboutsummaryrefslogtreecommitdiff
path: root/libdino/src/service
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2020-04-21 16:25:01 +0200
committerfiaxh <git@lightrise.org>2020-04-21 16:25:01 +0200
commit3a8fef7b7b3c101c4bcb8cd3d7460a009c98a41e (patch)
tree38bc8952916adf5fa6a3b178dedab44955ae977d /libdino/src/service
parent2419bf3b15758abfde7ac2eea52c5b791adfdf59 (diff)
downloaddino-3a8fef7b7b3c101c4bcb8cd3d7460a009c98a41e.tar.gz
dino-3a8fef7b7b3c101c4bcb8cd3d7460a009c98a41e.zip
Improve message read markers for MUCs
Diffstat (limited to 'libdino/src/service')
-rw-r--r--libdino/src/service/chat_interaction.vala15
1 files changed, 10 insertions, 5 deletions
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;
}