Don't offer encryption in MUC PMs
This commit is contained in:
parent
6d41071da1
commit
886a519d85
|
@ -86,8 +86,21 @@ public class EncryptionButton : MenuButton {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void update_visibility() {
|
private void update_visibility() {
|
||||||
visible = !stream_interactor.get_module(MucManager.IDENTITY).is_public_room(conversation.account, conversation.counterpart) ||
|
if (conversation.encryption != Encryption.NONE) {
|
||||||
conversation.encryption != Encryption.NONE;
|
visible = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch (conversation.type_) {
|
||||||
|
case Conversation.Type.CHAT:
|
||||||
|
visible = true;
|
||||||
|
break;
|
||||||
|
case Conversation.Type.GROUPCHAT_PM:
|
||||||
|
visible = false;
|
||||||
|
break;
|
||||||
|
case Conversation.Type.GROUPCHAT:
|
||||||
|
visible = stream_interactor.get_module(MucManager.IDENTITY).is_private_room(conversation.account, conversation.counterpart);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public new void set_conversation(Conversation conversation) {
|
public new void set_conversation(Conversation conversation) {
|
||||||
|
|
|
@ -95,6 +95,10 @@ public class Manager : StreamInteractionModule, Object {
|
||||||
|
|
||||||
private void on_pre_message_send(Entities.Message message, Xmpp.MessageStanza message_stanza, Conversation conversation) {
|
private void on_pre_message_send(Entities.Message message, Xmpp.MessageStanza message_stanza, Conversation conversation) {
|
||||||
if (message.encryption == Encryption.OMEMO) {
|
if (message.encryption == Encryption.OMEMO) {
|
||||||
|
if (message.type_ == Message.Type.GROUPCHAT_PM) {
|
||||||
|
message.marked = Message.Marked.WONTSEND;
|
||||||
|
return;
|
||||||
|
}
|
||||||
XmppStream? stream = stream_interactor.get_stream(conversation.account);
|
XmppStream? stream = stream_interactor.get_stream(conversation.account);
|
||||||
if (stream == null) {
|
if (stream == null) {
|
||||||
message.marked = Entities.Message.Marked.UNSENT;
|
message.marked = Entities.Message.Marked.UNSENT;
|
||||||
|
|
|
@ -37,6 +37,9 @@ public class BadMessagesPopulator : Plugins.ConversationItemPopulator, Plugins.C
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init_state() {
|
private void init_state() {
|
||||||
|
|
||||||
|
if (current_conversation.type_ == Conversation.Type.GROUPCHAT_PM) return;
|
||||||
|
|
||||||
var qry = db.identity_meta.select()
|
var qry = db.identity_meta.select()
|
||||||
.join_with(db.identity, db.identity.id, db.identity_meta.identity_id)
|
.join_with(db.identity, db.identity.id, db.identity_meta.identity_id)
|
||||||
.with(db.identity.account_id, "=", current_conversation.account.id)
|
.with(db.identity.account_id, "=", current_conversation.account.id)
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
using Dino.Entities;
|
||||||
using Gtk;
|
using Gtk;
|
||||||
using Qlite;
|
using Qlite;
|
||||||
using Xmpp;
|
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) {
|
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);
|
MucManager muc_manager = plugin.app.stream_interactor.get_module(MucManager.IDENTITY);
|
||||||
Manager omemo_manager = plugin.app.stream_interactor.get_module(Manager.IDENTITY);
|
Manager omemo_manager = plugin.app.stream_interactor.get_module(Manager.IDENTITY);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue