aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/parser
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2015-05-05 06:17:34 +0200
committerDaniel Gultsch <daniel@gultsch.de>2015-05-05 06:17:34 +0200
commit5136bf9832b9a7aeb59926b42fe6a6632452c1ef (patch)
treed7bbb29f6d9ec45d52003dd0f0d66a9596db42ef /src/main/java/eu/siacs/conversations/parser
parente6aa604aded25c304816164624b94bb8abe3d69f (diff)
r/o support for vcard avatars. pep avatars will be prefered
Diffstat (limited to 'src/main/java/eu/siacs/conversations/parser')
-rw-r--r--src/main/java/eu/siacs/conversations/parser/MessageParser.java2
-rw-r--r--src/main/java/eu/siacs/conversations/parser/PresenceParser.java15
2 files changed, 16 insertions, 1 deletions
diff --git a/src/main/java/eu/siacs/conversations/parser/MessageParser.java b/src/main/java/eu/siacs/conversations/parser/MessageParser.java
index 76d01468..7870fdbf 100644
--- a/src/main/java/eu/siacs/conversations/parser/MessageParser.java
+++ b/src/main/java/eu/siacs/conversations/parser/MessageParser.java
@@ -494,7 +494,7 @@ public class MessageParser extends AbstractParser implements
} else {
Contact contact = account.getRoster().getContact(
from);
- contact.setAvatar(avatar.getFilename());
+ contact.setAvatar(avatar);
mXmppConnectionService.getAvatarService().clear(
contact);
mXmppConnectionService.updateConversationUi();
diff --git a/src/main/java/eu/siacs/conversations/parser/PresenceParser.java b/src/main/java/eu/siacs/conversations/parser/PresenceParser.java
index 7505b091..f7872210 100644
--- a/src/main/java/eu/siacs/conversations/parser/PresenceParser.java
+++ b/src/main/java/eu/siacs/conversations/parser/PresenceParser.java
@@ -13,6 +13,7 @@ import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.xml.Element;
import eu.siacs.conversations.xmpp.OnPresencePacketReceived;
import eu.siacs.conversations.xmpp.jid.Jid;
+import eu.siacs.conversations.xmpp.pep.Avatar;
import eu.siacs.conversations.xmpp.stanzas.PresencePacket;
public class PresenceParser extends AbstractParser implements
@@ -101,6 +102,20 @@ public class PresenceParser extends AbstractParser implements
if (nick != null) {
contact.setPresenceName(nick.getContent());
}
+ Element x = packet.findChild("x","vcard-temp:x:update");
+ Avatar avatar = Avatar.parsePresence(x);
+ if (avatar != null && !contact.isSelf()) {
+ avatar.owner = from.toBareJid();
+ if (mXmppConnectionService.getFileBackend().isAvatarCached(avatar)) {
+ if (contact.setAvatar(avatar)) {
+ mXmppConnectionService.getAvatarService().clear(contact);
+ mXmppConnectionService.updateConversationUi();
+ mXmppConnectionService.updateRosterUi();
+ }
+ } else {
+ mXmppConnectionService.fetchAvatar(account,avatar);
+ }
+ }
mXmppConnectionService.updateRosterUi();
}