aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsteckbrief <steckbrief@chefmail.de>2016-09-29 11:58:17 +0200
committersteckbrief <steckbrief@chefmail.de>2016-09-29 11:58:17 +0200
commit9ec29bb1dcf664fea606105b7e700641a4b44ae4 (patch)
treef18349b7924668bc203a804606e432c61f71b511
parent34fcdda53fa8ae1174909b62860534d2d874eb72 (diff)
Fixes FS#29: Own Avatar not loaded
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/parser/PresenceParser.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/parser/PresenceParser.java b/src/main/java/de/thedevstack/conversationsplus/parser/PresenceParser.java
index f575aaac..e86e657e 100644
--- a/src/main/java/de/thedevstack/conversationsplus/parser/PresenceParser.java
+++ b/src/main/java/de/thedevstack/conversationsplus/parser/PresenceParser.java
@@ -6,6 +6,7 @@ import java.util.ArrayList;
import java.util.List;
import de.thedevstack.android.logcat.Logging;
+import de.thedevstack.conversationsplus.persistance.DatabaseBackend;
import de.thedevstack.conversationsplus.utils.AvatarUtil;
import de.thedevstack.conversationsplus.utils.UiUpdateHelper;
@@ -182,14 +183,19 @@ public class PresenceParser extends AbstractParser implements
final String resource = from.isBareJid() ? "" : from.getResourcepart();
contact.setPresenceName(packet.findChildContent("nick", "http://jabber.org/protocol/nick"));
Avatar avatar = Avatar.parsePresence(packet.findChild("x", "vcard-temp:x:update"));
- if (avatar != null && !contact.isSelf()) {
+ if (avatar != null && (!contact.isSelf() || null == account.getAvatar())) {
avatar.owner = from.toBareJid();
if (AvatarUtil.isAvatarCached(avatar)) {
- if (contact.setAvatar(avatar)) {
+ if (avatar.owner.equals(account.getJid().toBareJid())) {
+ account.setAvatar(avatar.getFilename());
+ DatabaseBackend.getInstance().updateAccount(account);
+ AvatarService.getInstance().clear(account);
+ UiUpdateHelper.updateAccountUi();
+ } else if (contact.setAvatar(avatar)) {
AvatarService.getInstance().clear(contact);
- UiUpdateHelper.updateConversationUi();
UiUpdateHelper.updateRosterUi();
}
+ UiUpdateHelper.updateConversationUi();
} else {
AvatarService.getInstance().fetchAvatar(account, avatar);
}