aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus/entities/Roster.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/entities/Roster.java')
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/entities/Roster.java17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/entities/Roster.java b/src/main/java/de/thedevstack/conversationsplus/entities/Roster.java
index 0c719ed9..b1cb78b4 100644
--- a/src/main/java/de/thedevstack/conversationsplus/entities/Roster.java
+++ b/src/main/java/de/thedevstack/conversationsplus/entities/Roster.java
@@ -2,6 +2,7 @@ package de.thedevstack.conversationsplus.entities;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import de.thedevstack.conversationsplus.xmpp.jid.Jid;
@@ -55,12 +56,15 @@ public class Roster {
}
}
- public void clearSystemAccounts() {
- for (Contact contact : getContacts()) {
- contact.setPhotoUri(null);
- contact.setSystemName(null);
- contact.setSystemAccount(null);
+ public List<Contact> getWithSystemAccounts() {
+ List<Contact> with = getContacts();
+ for(Iterator<Contact> iterator = with.iterator(); iterator.hasNext();) {
+ Contact contact = iterator.next();
+ if (contact.getSystemAccount() == null) {
+ iterator.remove();
+ }
}
+ return with;
}
public List<Contact> getContacts() {
@@ -70,6 +74,9 @@ public class Roster {
}
public void initContact(final Contact contact) {
+ if (contact == null) {
+ return;
+ }
contact.setAccount(account);
contact.setOption(Contact.Options.IN_ROSTER);
synchronized (this.contacts) {