aboutsummaryrefslogtreecommitdiff
path: root/libdino/src/service/conversation_manager.vala
diff options
context:
space:
mode:
Diffstat (limited to 'libdino/src/service/conversation_manager.vala')
-rw-r--r--libdino/src/service/conversation_manager.vala16
1 files changed, 7 insertions, 9 deletions
diff --git a/libdino/src/service/conversation_manager.vala b/libdino/src/service/conversation_manager.vala
index 66efe56e..77205c57 100644
--- a/libdino/src/service/conversation_manager.vala
+++ b/libdino/src/service/conversation_manager.vala
@@ -27,7 +27,7 @@ public class ConversationManager : StreamInteractionModule, Object {
stream_interactor.add_module(this);
stream_interactor.account_added.connect(on_account_added);
stream_interactor.get_module(MessageProcessor.IDENTITY).received_pipeline.connect(new MessageListener(stream_interactor));
- stream_interactor.get_module(MessageProcessor.IDENTITY).message_sent.connect(handle_new_message);
+ stream_interactor.get_module(MessageProcessor.IDENTITY).message_sent.connect(handle_sent_message);
}
public Conversation create_conversation(Jid jid, Account account, Conversation.Type? type = null) {
@@ -133,8 +133,8 @@ public class ConversationManager : StreamInteractionModule, Object {
public override async bool run(Entities.Message message, Xmpp.MessageStanza stanza, Conversation conversation) {
conversation.last_active = message.time;
- if (message.stanza != null) {
- bool is_mam_message = Xep.MessageArchiveManagement.MessageFlag.get_flag(message.stanza) != null;
+ if (stanza != null) {
+ bool is_mam_message = Xep.MessageArchiveManagement.MessageFlag.get_flag(stanza) != null;
bool is_recent = message.local_time.compare(new DateTime.now_utc().add_hours(-24)) > 0;
if (is_mam_message && !is_recent) return false;
}
@@ -143,15 +143,13 @@ public class ConversationManager : StreamInteractionModule, Object {
}
}
- private void handle_new_message(Entities.Message message, Conversation conversation) {
+ private void handle_sent_message(Entities.Message message, Conversation conversation) {
conversation.last_active = message.time;
- if (message.stanza != null) {
- bool is_mam_message = Xep.MessageArchiveManagement.MessageFlag.get_flag(message.stanza) != null;
- bool is_recent = message.local_time.compare(new DateTime.now_utc().add_hours(-24)) > 0;
- if (is_mam_message && !is_recent) return;
+ bool is_recent = message.local_time.compare(new DateTime.now_utc().add_hours(-24)) > 0;
+ if (is_recent) {
+ start_conversation(conversation);
}
- start_conversation(conversation);
}
private void add_conversation(Conversation conversation) {