aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libdino/src/service/chat_interaction.vala4
-rw-r--r--main/src/ui/conversation_selector/conversation_row.vala15
-rw-r--r--main/src/ui/conversation_selector/list.vala6
3 files changed, 5 insertions, 20 deletions
diff --git a/libdino/src/service/chat_interaction.vala b/libdino/src/service/chat_interaction.vala
index f08534aa..036d9e59 100644
--- a/libdino/src/service/chat_interaction.vala
+++ b/libdino/src/service/chat_interaction.vala
@@ -11,8 +11,6 @@ public class ChatInteraction : StreamInteractionModule, Object {
public signal void focused_in(Conversation conversation);
public signal void focused_out(Conversation conversation);
- public signal void conversation_read(Conversation conversation);
- public signal void conversation_unread(Conversation conversation);
private StreamInteractor stream_interactor;
private Conversation? selected_conversation;
@@ -80,7 +78,6 @@ public class ChatInteraction : StreamInteractionModule, Object {
focus_in = true;
if (conversation == null) return;
focused_in(selected_conversation);
- conversation_read(selected_conversation);
check_send_read();
selected_conversation.read_up_to = stream_interactor.get_module(MessageStorage.IDENTITY).get_last_message(conversation);
}
@@ -137,7 +134,6 @@ public class ChatInteraction : StreamInteractionModule, Object {
send_chat_marker(conversation, message, Xep.ChatMarkers.MARKER_DISPLAYED);
} else {
send_chat_marker(conversation, message, Xep.ChatMarkers.MARKER_RECEIVED);
- conversation_unread(conversation);
}
}
diff --git a/main/src/ui/conversation_selector/conversation_row.vala b/main/src/ui/conversation_selector/conversation_row.vala
index da9dbf68..a838124d 100644
--- a/main/src/ui/conversation_selector/conversation_row.vala
+++ b/main/src/ui/conversation_selector/conversation_row.vala
@@ -57,14 +57,7 @@ public abstract class ConversationRow : ListBoxRow {
last_message = stream_interactor.get_module(MessageStorage.IDENTITY).get_last_message(conversation) ?? m;
update_message_label();
update_time_label();
- }
-
- public void mark_read() {
- update_read(true);
- }
-
- public void mark_unread() {
- update_read(false);
+ update_read();
}
public virtual void on_show_received(Show presence) {
@@ -103,8 +96,10 @@ public abstract class ConversationRow : ListBoxRow {
}
}
- protected void update_read(bool read) {
- this.read = read;
+ protected void update_read() {
+ bool read_was = read;
+ read = last_message == null || (conversation.read_up_to != null && last_message.equals(conversation.read_up_to));
+ if (read == read_was) return;
if (read) {
name_label.attributes.filter((attr) => attr.equal(attr_weight_new(Weight.BOLD)));
time_label.attributes.filter((attr) => attr.equal(attr_weight_new(Weight.BOLD)));
diff --git a/main/src/ui/conversation_selector/list.vala b/main/src/ui/conversation_selector/list.vala
index d49a009f..6e9a0ec2 100644
--- a/main/src/ui/conversation_selector/list.vala
+++ b/main/src/ui/conversation_selector/list.vala
@@ -22,12 +22,6 @@ public class List : ListBox {
set_header_func(header);
set_sort_func(sort);
- stream_interactor.get_module(ChatInteraction.IDENTITY).conversation_read.connect((conversation) => {
- Idle.add(() => { if (rows.has_key(conversation)) rows[conversation].mark_read(); return false; });
- });
- stream_interactor.get_module(ChatInteraction.IDENTITY).conversation_unread.connect((conversation) => {
- Idle.add(() => { if (rows.has_key(conversation)) rows[conversation].mark_unread(); return false; });
- });
stream_interactor.get_module(ConversationManager.IDENTITY).conversation_activated.connect((conversation) => {
Idle.add(() => { add_conversation(conversation); return false; });
});