aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-02-10 21:09:24 +0100
committerChristian Schneppe <christian@pix-art.de>2017-02-10 21:09:24 +0100
commit52b34a698162ec7d2e249b1a75b42c6a4d465146 (patch)
treef2c240679523dc096d9cec20ed8eea7a7bce2b29 /src/main/java
parent53b200f6b17d134c8efbe19ef98d427548b46589 (diff)
clear avatar cache when system name changes
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/de/pixart/messenger/entities/Contact.java4
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java10
2 files changed, 9 insertions, 5 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/Contact.java b/src/main/java/de/pixart/messenger/entities/Contact.java
index 02fe85eac..1e55526ce 100644
--- a/src/main/java/de/pixart/messenger/entities/Contact.java
+++ b/src/main/java/de/pixart/messenger/entities/Contact.java
@@ -255,8 +255,10 @@ public class Contact implements ListItem, Blockable {
this.serverName = serverName;
}
- public void setSystemName(String systemName) {
+ public boolean setSystemName(String systemName) {
+ String old = this.systemName;
this.systemName = systemName;
+ return (old == null && systemName != null) || (old != null && !old.equals(systemName));
}
public void setPresenceName(String presenceName) {
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
index a81adfe23..8722bc3b7 100644
--- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
+++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
@@ -1590,16 +1590,18 @@ public class XmppConnectionService extends Service {
+ "#"
+ phoneContact.getString("lookup");
contact.setSystemAccount(systemAccount);
- if (contact.setPhotoUri(phoneContact.getString("photouri"))) {
+ boolean needsCacheClean = contact.setPhotoUri(phoneContact.getString("photouri"));
+ needsCacheClean |= contact.setSystemName(phoneContact.getString("displayname"));
+ if (needsCacheClean) {
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)) {
+ boolean needsCacheClean = contact.setPhotoUri(null);
+ needsCacheClean |= contact.setSystemName(null);
+ if (needsCacheClean) {
getAvatarService().clear(contact);
}
}