diff options
author | fiaxh <git@lightrise.org> | 2019-05-21 21:42:39 +0200 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2019-05-26 20:20:09 +0200 |
commit | 03f25e1f87dd4608c7cf4d0f97d1cb2e0141094d (patch) | |
tree | edbbef9cad6e0548ea27bb09c988b4717c49cb37 /libdino/src/service/conversation_manager.vala | |
parent | 32687d731f50969545e0122e13c395cfa5f859a1 (diff) | |
download | dino-03f25e1f87dd4608c7cf4d0f97d1cb2e0141094d.tar.gz dino-03f25e1f87dd4608c7cf4d0f97d1cb2e0141094d.zip |
Remove Message.stanza field
Diffstat (limited to 'libdino/src/service/conversation_manager.vala')
-rw-r--r-- | libdino/src/service/conversation_manager.vala | 16 |
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) { |