aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/services
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-07-09 21:55:00 +0200
committerChristian Schneppe <christian@pix-art.de>2018-07-09 21:55:00 +0200
commitda802b4248998584c9233a1b268020f8df2696af (patch)
tree7e2d0efd27ec935e3cd53549d5ae40affa9f4d53 /src/main/java/de/pixart/messenger/services
parentf7959d2f7ec0b6a93637033a6cdf7a4ebf71ecf6 (diff)
persist muc avatar and show in bookmarks
Diffstat (limited to 'src/main/java/de/pixart/messenger/services')
-rw-r--r--src/main/java/de/pixart/messenger/services/AvatarService.java10
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java18
2 files changed, 19 insertions, 9 deletions
diff --git a/src/main/java/de/pixart/messenger/services/AvatarService.java b/src/main/java/de/pixart/messenger/services/AvatarService.java
index 06b0e1f5f..bf415515b 100644
--- a/src/main/java/de/pixart/messenger/services/AvatarService.java
+++ b/src/main/java/de/pixart/messenger/services/AvatarService.java
@@ -54,7 +54,7 @@ public class AvatarService implements OnAdvancedStreamFeaturesLoaded {
protected XmppConnectionService mXmppConnectionService = null;
- public AvatarService(XmppConnectionService service) {
+ AvatarService(XmppConnectionService service) {
this.mXmppConnectionService = service;
}
@@ -231,7 +231,13 @@ public class AvatarService implements OnAdvancedStreamFeaturesLoaded {
if (bookmark.getConversation() != null) {
return get(bookmark.getConversation(), size, cachedOnly);
} else {
- String seed = bookmark.getJid() != null ? bookmark.getJid().asBareJid().toString() : null;
+ Jid jid = bookmark.getJid();
+ Account account = bookmark.getAccount();
+ Contact contact = jid == null ? null : account.getRoster().getContact(jid);
+ if (contact != null && contact.getAvatar() != null) {
+ return get(contact, size, cachedOnly);
+ }
+ String seed = jid != null ? jid.asBareJid().toString() : null;
return get(bookmark.getDisplayName(), seed, size, cachedOnly);
}
} else {
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
index f45a5ac8e..bf760949a 100644
--- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
+++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
@@ -3223,10 +3223,12 @@ public class XmppConnectionService extends Service {
updateAccountUi();
} else {
Contact contact = a.getRoster().getContact(avatar.owner);
- contact.setAvatar(avatar);
- getAvatarService().clear(contact);
- updateConversationUi();
- updateRosterUi();
+ if (contact.setAvatar(avatar)) {
+ syncRoster(account);
+ getAvatarService().clear(contact);
+ updateConversationUi();
+ updateRosterUi();
+ }
}
if (callback != null) {
callback.success(avatar);
@@ -3278,9 +3280,11 @@ public class XmppConnectionService extends Service {
updateAccountUi();
} else {
Contact contact = account.getRoster().getContact(avatar.owner);
- contact.setAvatar(avatar);
- getAvatarService().clear(contact);
- updateRosterUi();
+ if (contact.setAvatar(avatar)) {
+ syncRoster(account);
+ getAvatarService().clear(contact);
+ updateRosterUi();
+ }
}
updateConversationUi();
} else {