diff options
author | Marvin W <git@larma.de> | 2018-01-12 21:03:09 +0100 |
---|---|---|
committer | fiaxh <git@mx.ax.lt> | 2018-01-28 00:38:47 +0100 |
commit | 782ae4c049e2b6fab13d7453cbb0e74610e7d200 (patch) | |
tree | 1b4cd0a1689cee0c2e2cac2ae9a5fb8ebbe63621 /libdino/src/service/conversation_manager.vala | |
parent | d46d071e57e599e8cfb1780597cbecb36881c4d8 (diff) | |
download | dino-782ae4c049e2b6fab13d7453cbb0e74610e7d200.tar.gz dino-782ae4c049e2b6fab13d7453cbb0e74610e7d200.zip |
Move Jid class to xmpp-vala, partially refactor namespace
Diffstat (limited to 'libdino/src/service/conversation_manager.vala')
-rw-r--r-- | libdino/src/service/conversation_manager.vala | 14 |
1 files changed, 8 insertions, 6 deletions
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<Conversation> get_active_conversations() { + public Gee.List<Conversation> get_active_conversations(Account? account = null) { Gee.List<Conversation> ret = new ArrayList<Conversation>(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); } } |