diff options
author | fiaxh <git@lightrise.org> | 2020-10-15 19:43:17 +0200 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2020-10-15 19:52:30 +0200 |
commit | 5954f7764f239d213ae5b30887994f4af535b81f (patch) | |
tree | 27c9691b8f61c840b53c9e85e39b535e623b33aa /libdino/src/service/conversation_manager.vala | |
parent | 518307d1acad15e9a7d5cd478c6de32442ea7641 (diff) | |
download | dino-5954f7764f239d213ae5b30887994f4af535b81f.tar.gz dino-5954f7764f239d213ae5b30887994f4af535b81f.zip |
Fix own message marker marking conversations as read
Diffstat (limited to 'libdino/src/service/conversation_manager.vala')
-rw-r--r-- | libdino/src/service/conversation_manager.vala | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/libdino/src/service/conversation_manager.vala b/libdino/src/service/conversation_manager.vala index dcb0ced4..8b33f52f 100644 --- a/libdino/src/service/conversation_manager.vala +++ b/libdino/src/service/conversation_manager.vala @@ -84,15 +84,20 @@ public class ConversationManager : StreamInteractionModule, Object { return null; } - public Conversation? approx_conversation_for_stanza(Jid jid, Account account, string msg_ty) { + public Conversation? approx_conversation_for_stanza(Jid from, Jid to, Account account, string msg_ty) { if (msg_ty == Xmpp.MessageStanza.TYPE_GROUPCHAT) { - return get_conversation(jid.bare_jid, account, Conversation.Type.GROUPCHAT); - } else if (msg_ty == Xmpp.MessageStanza.TYPE_CHAT && jid.is_full() && - get_conversation(jid.bare_jid, account, Conversation.Type.GROUPCHAT) != null) { - var pm = get_conversation(jid, account, Conversation.Type.GROUPCHAT_PM); + return get_conversation(from.bare_jid, account, Conversation.Type.GROUPCHAT); + } + + Jid counterpart = from.equals_bare(account.bare_jid) ? to : from; + + if (msg_ty == Xmpp.MessageStanza.TYPE_CHAT && counterpart.is_full() && + get_conversation(counterpart.bare_jid, account, Conversation.Type.GROUPCHAT) != null) { + var pm = get_conversation(counterpart, account, Conversation.Type.GROUPCHAT_PM); if (pm != null) return pm; } - return get_conversation(jid.bare_jid, account, Conversation.Type.CHAT); + + return get_conversation(counterpart.bare_jid, account, Conversation.Type.CHAT); } public Conversation? get_conversation_by_id(int id) { |