From f0d5dc583d372e373aeee95c6ee07814db34d63d Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sat, 3 Nov 2018 16:32:08 +0100 Subject: [PATCH] use inContactList() instead inRoster() in the proper places --- .../java/eu/siacs/conversations/entities/Message.java | 4 +--- .../java/eu/siacs/conversations/entities/MucOptions.java | 2 +- src/main/java/eu/siacs/conversations/entities/Roster.java | 8 ++++---- .../conversations/services/XmppConnectionService.java | 2 +- .../siacs/conversations/ui/ConferenceDetailsActivity.java | 2 +- .../java/eu/siacs/conversations/ui/ShortcutActivity.java | 2 +- 6 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/entities/Message.java b/src/main/java/eu/siacs/conversations/entities/Message.java index 0ba7b1516..6cefba222 100644 --- a/src/main/java/eu/siacs/conversations/entities/Message.java +++ b/src/main/java/eu/siacs/conversations/entities/Message.java @@ -15,8 +15,6 @@ import java.util.Set; import eu.siacs.conversations.Config; import eu.siacs.conversations.crypto.axolotl.FingerprintStatus; -import eu.siacs.conversations.http.AesGcmURLStreamHandler; -import eu.siacs.conversations.ui.adapter.MessageAdapter; import eu.siacs.conversations.utils.CryptoHelper; import eu.siacs.conversations.utils.Emoticons; import eu.siacs.conversations.utils.GeoHelper; @@ -290,7 +288,7 @@ public class Message extends AbstractEntity { return null; } else { return this.conversation.getAccount().getRoster() - .getContactFromRoster(this.trueCounterpart); + .getContactFromContactList(this.trueCounterpart); } } } diff --git a/src/main/java/eu/siacs/conversations/entities/MucOptions.java b/src/main/java/eu/siacs/conversations/entities/MucOptions.java index 631987706..133916856 100644 --- a/src/main/java/eu/siacs/conversations/entities/MucOptions.java +++ b/src/main/java/eu/siacs/conversations/entities/MucOptions.java @@ -719,7 +719,7 @@ public class MucOptions { public Contact getContact() { if (fullJid != null) { - return getAccount().getRoster().getContactFromRoster(realJid); + return getAccount().getRoster().getContactFromContactList(realJid); } else if (realJid != null) { return getAccount().getRoster().getContact(realJid); } else { diff --git a/src/main/java/eu/siacs/conversations/entities/Roster.java b/src/main/java/eu/siacs/conversations/entities/Roster.java index f238c96b0..a72766f00 100644 --- a/src/main/java/eu/siacs/conversations/entities/Roster.java +++ b/src/main/java/eu/siacs/conversations/entities/Roster.java @@ -10,21 +10,21 @@ import rocks.xmpp.addr.Jid; public class Roster { - final Account account; - final HashMap contacts = new HashMap<>(); + private final Account account; + private final HashMap contacts = new HashMap<>(); private String version = null; public Roster(Account account) { this.account = account; } - public Contact getContactFromRoster(Jid jid) { + public Contact getContactFromContactList(Jid jid) { if (jid == null) { return null; } synchronized (this.contacts) { Contact contact = contacts.get(jid.asBareJid()); - if (contact != null && contact.showInRoster()) { + if (contact != null && contact.showInContactList()) { return contact; } else { return null; diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 80a611f1e..d1ebe0390 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -3685,7 +3685,7 @@ public class XmppConnectionService extends Service { for (Account account : getAccounts()) { if ((account.isEnabled() || accountJid != null) && (accountJid == null || accountJid.equals(account.getJid().asBareJid().toString()))) { - Contact contact = account.getRoster().getContactFromRoster(jid); + Contact contact = account.getRoster().getContactFromContactList(jid); if (contact != null) { contacts.add(contact); } diff --git a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java index 74f4d5379..5b3707b03 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java @@ -433,7 +433,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers this.mSelectedUser = user; String name; final Contact contact = user.getContact(); - if (contact != null && contact.showInRoster()) { + if (contact != null && contact.showInContactList()) { name = contact.getDisplayName(); } else if (user.getRealJid() != null) { name = user.getRealJid().asBareJid().toString(); diff --git a/src/main/java/eu/siacs/conversations/ui/ShortcutActivity.java b/src/main/java/eu/siacs/conversations/ui/ShortcutActivity.java index bfffbdff7..d230e0f58 100644 --- a/src/main/java/eu/siacs/conversations/ui/ShortcutActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ShortcutActivity.java @@ -55,7 +55,7 @@ public class ShortcutActivity extends AbstractSearchableListItemActivity{ for (final Account account : xmppConnectionService.getAccounts()) { if (account.getStatus() != Account.State.DISABLED) { for (final Contact contact : account.getRoster().getContacts()) { - if (contact.showInRoster() + if (contact.showInContactList() && contact.match(this, needle)) { getListItems().add(contact); }