aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/services
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2015-06-03 14:05:54 +0200
committerDaniel Gultsch <daniel@gultsch.de>2015-06-03 14:05:54 +0200
commit53e8964dc17e5c994eda369e78c3bb81133abd9b (patch)
treec2dba2530cfe2a7b7e5f7d0db87629b4fecdb637 /src/main/java/eu/siacs/conversations/services
parent3eab3291dee7a3d20d2cf6ccb14da3e59562470f (diff)
reworked handeling of system contacts
Diffstat (limited to 'src/main/java/eu/siacs/conversations/services')
-rw-r--r--src/main/java/eu/siacs/conversations/services/XmppConnectionService.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
index fa8dd7d66..7b5532a4a 100644
--- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
@@ -927,7 +927,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
public void run() {
Log.d(Config.LOGTAG,"start merging phone contacts with roster");
for (Account account : accounts) {
- account.getRoster().clearSystemAccounts();
+ List<Contact> withSystemAccounts = account.getRoster().getWithSystemAccounts();
for (Bundle phoneContact : phoneContacts) {
if (Thread.interrupted()) {
Log.d(Config.LOGTAG,"interrupted merging phone contacts");
@@ -944,9 +944,18 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
+ "#"
+ phoneContact.getString("lookup");
contact.setSystemAccount(systemAccount);
- contact.setPhotoUri(phoneContact.getString("photouri"));
- getAvatarService().clear(contact);
+ if (contact.setPhotoUri(phoneContact.getString("photouri"))) {
+ getAvatarService().clear(contact);
+ }
contact.setSystemName(phoneContact.getString("displayname"));
+ withSystemAccounts.remove(contact);
+ }
+ for(Contact contact : withSystemAccounts) {
+ contact.setSystemAccount(null);
+ contact.setSystemName(null);
+ if (contact.setPhotoUri(null)) {
+ getAvatarService().clear(contact);
+ }
}
}
Log.d(Config.LOGTAG,"finished merging phone contacts");