From 886a519d8543cba45792a08210093c851f20a2a0 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Wed, 17 Jun 2020 14:30:46 +0200 Subject: Don't offer encryption in MUC PMs --- plugins/omemo/src/ui/bad_messages_populator.vala | 3 +++ plugins/omemo/src/ui/encryption_list_entry.vala | 5 +++++ 2 files changed, 8 insertions(+) (limited to 'plugins/omemo/src/ui') diff --git a/plugins/omemo/src/ui/bad_messages_populator.vala b/plugins/omemo/src/ui/bad_messages_populator.vala index b8f38434..5a881c25 100644 --- a/plugins/omemo/src/ui/bad_messages_populator.vala +++ b/plugins/omemo/src/ui/bad_messages_populator.vala @@ -37,6 +37,9 @@ public class BadMessagesPopulator : Plugins.ConversationItemPopulator, Plugins.C } private void init_state() { + + if (current_conversation.type_ == Conversation.Type.GROUPCHAT_PM) return; + var qry = db.identity_meta.select() .join_with(db.identity, db.identity.id, db.identity_meta.identity_id) .with(db.identity.account_id, "=", current_conversation.account.id) diff --git a/plugins/omemo/src/ui/encryption_list_entry.vala b/plugins/omemo/src/ui/encryption_list_entry.vala index aaec517f..a0e6bb0f 100644 --- a/plugins/omemo/src/ui/encryption_list_entry.vala +++ b/plugins/omemo/src/ui/encryption_list_entry.vala @@ -1,3 +1,4 @@ +using Dino.Entities; using Gtk; using Qlite; using Xmpp; @@ -42,6 +43,10 @@ public class EncryptionListEntry : Plugins.EncryptionListEntry, Object { } public async void encryption_activated_async(Entities.Conversation conversation, Plugins.SetInputFieldStatus input_status_callback) { + if (conversation.type_ == Conversation.Type.GROUPCHAT_PM) { + input_status_callback(new Plugins.InputFieldStatus("Can't use encryption in a groupchat private message.", Plugins.InputFieldStatus.MessageType.ERROR, Plugins.InputFieldStatus.InputState.NO_SEND)); + return; + } MucManager muc_manager = plugin.app.stream_interactor.get_module(MucManager.IDENTITY); Manager omemo_manager = plugin.app.stream_interactor.get_module(Manager.IDENTITY); -- cgit v1.2.3-70-g09d2