diff options
Diffstat (limited to 'src/main/java/de/pixart/messenger/entities/Roster.java')
-rw-r--r-- | src/main/java/de/pixart/messenger/entities/Roster.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/Roster.java b/src/main/java/de/pixart/messenger/entities/Roster.java index 2db0c796e..13856c068 100644 --- a/src/main/java/de/pixart/messenger/entities/Roster.java +++ b/src/main/java/de/pixart/messenger/entities/Roster.java @@ -5,24 +5,25 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; +import de.pixart.messenger.android.AbstractPhoneContact; import rocks.xmpp.addr.Jid; public class Roster { - final Account account; - final HashMap<Jid, Contact> contacts = new HashMap<>(); + private final Account account; + private final HashMap<Jid, Contact> 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; @@ -54,11 +55,12 @@ public class Roster { } } - public List<Contact> getWithSystemAccounts() { + public List<Contact> getWithSystemAccounts(Class<?extends AbstractPhoneContact> clazz) { + int option = Contact.getOption(clazz); List<Contact> with = getContacts(); for (Iterator<Contact> iterator = with.iterator(); iterator.hasNext(); ) { Contact contact = iterator.next(); - if (contact.getSystemAccount() == null) { + if (!contact.getOption(option)) { iterator.remove(); } } |