aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus/parser/PresenceParser.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/parser/PresenceParser.java')
-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);
}