do not use omemo by default for own server

This commit is contained in:
Daniel Gultsch 2018-04-21 19:52:37 +02:00
parent fc62cbbc52
commit 12127a0b6e
2 changed files with 9 additions and 2 deletions

View file

@ -443,7 +443,11 @@ public class Contact implements ListItem, Blockable {
} }
public boolean isSelf() { 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) { public void setCommonName(String cn) {

View file

@ -622,6 +622,9 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
if (conversation.getJid().asBareJid().equals(Config.BUG_REPORTS)) { if (conversation.getJid().asBareJid().equals(Config.BUG_REPORTS)) {
return false; return false;
} }
if (conversation.getContact().isOwnServer()) {
return false;
}
final String contact = conversation.getJid().getDomain(); final String contact = conversation.getJid().getDomain();
final String account = conversation.getAccount().getServer(); final String account = conversation.getAccount().getServer();
if (Config.OMEMO_EXCEPTIONS.CONTACT_DOMAINS.contains(contact) || Config.OMEMO_EXCEPTIONS.ACCOUNT_DOMAINS.contains(account)) { 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() { public boolean isWithStranger() {
final Contact contact = getContact(); final Contact contact = getContact();
return mode == MODE_SINGLE return mode == MODE_SINGLE
&& !contactJid.equals(Jid.ofDomain(account.getJid().getDomain())) && !contact.isOwnServer()
&& !contact.showInRoster() && !contact.showInRoster()
&& !contact.isSelf() && !contact.isSelf()
&& sentMessagesCount() == 0; && sentMessagesCount() == 0;