From 782ae4c049e2b6fab13d7453cbb0e74610e7d200 Mon Sep 17 00:00:00 2001 From: Marvin W Date: Fri, 12 Jan 2018 21:03:09 +0100 Subject: Move Jid class to xmpp-vala, partially refactor namespace --- libdino/src/service/conversation_manager.vala | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'libdino/src/service/conversation_manager.vala') diff --git a/libdino/src/service/conversation_manager.vala b/libdino/src/service/conversation_manager.vala index 986cb0f1..e66ecca0 100644 --- a/libdino/src/service/conversation_manager.vala +++ b/libdino/src/service/conversation_manager.vala @@ -33,9 +33,10 @@ public class ConversationManager : StreamInteractionModule, Object { public Conversation create_conversation(Jid jid, Account account, Conversation.Type? type = null) { assert(conversations.has_key(account)); - if (conversations[account].has_key(jid)) { - conversations[account][jid].type_ = type; - return conversations[account][jid]; + Jid store_jid = type == Conversation.Type.GROUPCHAT ? jid.bare_jid : jid; + if (conversations[account].has_key(store_jid)) { + conversations[account][store_jid].type_ = type; + return conversations[account][store_jid]; } else { Conversation conversation = new Conversation(jid, account, type); add_conversation(conversation); @@ -84,10 +85,11 @@ public class ConversationManager : StreamInteractionModule, Object { return null; } - public Gee.List get_active_conversations() { + public Gee.List get_active_conversations(Account? account = null) { Gee.List ret = new ArrayList(Conversation.equals_func); - foreach (Account account in conversations.keys) { - foreach (Conversation conversation in conversations[account].values) { + foreach (Account account_ in conversations.keys) { + if (account != null && !account_.equals(account)) continue; + foreach (Conversation conversation in conversations[account_].values) { if(conversation.active) ret.add(conversation); } } -- cgit v1.2.3-54-g00ecf