From 12127a0b6ee8dc9a85466f613c0a069528664b54 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sat, 21 Apr 2018 19:52:37 +0200 Subject: [PATCH] do not use omemo by default for own server --- src/main/java/eu/siacs/conversations/entities/Contact.java | 6 +++++- .../java/eu/siacs/conversations/entities/Conversation.java | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/entities/Contact.java b/src/main/java/eu/siacs/conversations/entities/Contact.java index 5df1582f3..c17d92c06 100644 --- a/src/main/java/eu/siacs/conversations/entities/Contact.java +++ b/src/main/java/eu/siacs/conversations/entities/Contact.java @@ -443,7 +443,11 @@ public class Contact implements ListItem, Blockable { } public boolean isSelf() { - return account.getJid().asBareJid().equals(getJid().asBareJid()); + return account.getJid().asBareJid().equals(jid.asBareJid()); + } + + public boolean isOwnServer() { + return account.getJid().getDomain().equals(jid.getDomain()); } public void setCommonName(String cn) { diff --git a/src/main/java/eu/siacs/conversations/entities/Conversation.java b/src/main/java/eu/siacs/conversations/entities/Conversation.java index ae0a820a9..ff39ba611 100644 --- a/src/main/java/eu/siacs/conversations/entities/Conversation.java +++ b/src/main/java/eu/siacs/conversations/entities/Conversation.java @@ -622,6 +622,9 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl if (conversation.getJid().asBareJid().equals(Config.BUG_REPORTS)) { return false; } + if (conversation.getContact().isOwnServer()) { + return false; + } final String contact = conversation.getJid().getDomain(); final String account = conversation.getAccount().getServer(); if (Config.OMEMO_EXCEPTIONS.CONTACT_DOMAINS.contains(contact) || Config.OMEMO_EXCEPTIONS.ACCOUNT_DOMAINS.contains(account)) { @@ -922,7 +925,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl public boolean isWithStranger() { final Contact contact = getContact(); return mode == MODE_SINGLE - && !contactJid.equals(Jid.ofDomain(account.getJid().getDomain())) + && !contact.isOwnServer() && !contact.showInRoster() && !contact.isSelf() && sentMessagesCount() == 0;