diff options
author | fiaxh <git@lightrise.org> | 2019-08-27 22:12:18 +0200 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2019-08-28 13:11:56 +0200 |
commit | e52a4eacb2a3410a80156a50c267b5ac4b6d49ae (patch) | |
tree | 66b8e13ee9ec00aff7685a8059add23ee9066688 | |
parent | d02f7b6a3ace7c9248db15996e7a6d50a22d2582 (diff) | |
download | dino-e52a4eacb2a3410a80156a50c267b5ac4b6d49ae.tar.gz dino-e52a4eacb2a3410a80156a50c267b5ac4b6d49ae.zip |
Don't show conversations from account after it was disabled
fixes #277
-rw-r--r-- | libdino/src/service/conversation_manager.vala | 9 | ||||
-rw-r--r-- | main/src/ui/conversation_selector/conversation_selector.vala | 2 | ||||
-rw-r--r-- | main/src/ui/manage_accounts/dialog.vala | 1 |
3 files changed, 10 insertions, 2 deletions
diff --git a/libdino/src/service/conversation_manager.vala b/libdino/src/service/conversation_manager.vala index 039bad53..10ba5f6d 100644 --- a/libdino/src/service/conversation_manager.vala +++ b/libdino/src/service/conversation_manager.vala @@ -26,6 +26,7 @@ public class ConversationManager : StreamInteractionModule, Object { this.stream_interactor = stream_interactor; stream_interactor.add_module(this); stream_interactor.account_added.connect(on_account_added); + stream_interactor.account_removed.connect(on_account_removed); stream_interactor.get_module(MessageProcessor.IDENTITY).received_pipeline.connect(new MessageListener(stream_interactor)); stream_interactor.get_module(MessageProcessor.IDENTITY).message_sent.connect(handle_sent_message); } @@ -136,6 +137,14 @@ public class ConversationManager : StreamInteractionModule, Object { } } + private void on_account_removed(Account account) { + foreach (Gee.List<Conversation> list in conversations[account].values) { + foreach (var conversation in list) { + if(conversation.active) conversation_deactivated(conversation); + } + } + } + private class MessageListener : Dino.MessageListener { public string[] after_actions_const = new string[]{ "DEDUPLICATE", "FILTER_EMPTY" }; diff --git a/main/src/ui/conversation_selector/conversation_selector.vala b/main/src/ui/conversation_selector/conversation_selector.vala index 66cb3495..869f6403 100644 --- a/main/src/ui/conversation_selector/conversation_selector.vala +++ b/main/src/ui/conversation_selector/conversation_selector.vala @@ -93,7 +93,7 @@ public class ConversationSelector : ListBox { private void remove_conversation(Conversation conversation) { select_fallback_conversation(conversation); - if (rows.has_key(conversation) && !conversation.active) { + if (rows.has_key(conversation)) { remove(rows[conversation]); rows.unset(conversation); } diff --git a/main/src/ui/manage_accounts/dialog.vala b/main/src/ui/manage_accounts/dialog.vala index bb0614a2..e605e083 100644 --- a/main/src/ui/manage_accounts/dialog.vala +++ b/main/src/ui/manage_accounts/dialog.vala @@ -173,7 +173,6 @@ public class Dialog : Gtk.Dialog { private bool change_account_state(bool state) { selected_account.enabled = state; if (state) { - if (selected_account.enabled) account_disabled(selected_account); account_enabled(selected_account); } else { account_disabled(selected_account); |