diff options
-rw-r--r-- | src/eu/siacs/conversations/parser/MessageParser.java | 22 | ||||
-rw-r--r-- | src/eu/siacs/conversations/ui/adapter/MessageAdapter.java | 7 |
2 files changed, 17 insertions, 12 deletions
diff --git a/src/eu/siacs/conversations/parser/MessageParser.java b/src/eu/siacs/conversations/parser/MessageParser.java index f1b326ac..7de7e9e1 100644 --- a/src/eu/siacs/conversations/parser/MessageParser.java +++ b/src/eu/siacs/conversations/parser/MessageParser.java @@ -189,7 +189,7 @@ public class MessageParser extends AbstractParser implements } Element message = forwarded.findChild("message"); if ((message == null) || (!message.hasChild("body"))) { - if (status == Message.STATUS_RECIEVED) { + if (status == Message.STATUS_RECIEVED && message.getAttribute("from")!=null) { parseNormal(message, account); } return null; @@ -296,17 +296,19 @@ public class MessageParser extends AbstractParser implements if (node != null) { if (node.equals("urn:xmpp:avatar:metadata")) { Avatar avatar = Avatar.parseMetadata(items); - avatar.owner = from; - if (mXmppConnectionService.getFileBackend().isAvatarCached( - avatar)) { - if (account.getJid().equals(from)) { - account.setAvatar(avatar.getFilename()); + if (avatar!=null) { + avatar.owner = from; + if (mXmppConnectionService.getFileBackend().isAvatarCached( + avatar)) { + if (account.getJid().equals(from)) { + account.setAvatar(avatar.getFilename()); + } else { + Contact contact = account.getRoster().getContact(from); + contact.setAvatar(avatar.getFilename()); + } } else { - Contact contact = account.getRoster().getContact(from); - contact.setAvatar(avatar.getFilename()); + mXmppConnectionService.fetchAvatar(account, avatar); } - } else { - mXmppConnectionService.fetchAvatar(account, avatar); } } else { Log.d("xmppService", account.getJid() + ": " + node + " from " diff --git a/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java index ca475cc9..34fea41f 100644 --- a/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java +++ b/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java @@ -389,8 +389,11 @@ public class MessageAdapter extends ArrayAdapter<Message> { viewHolder.contact_picture.setImageBitmap(mBitmapCache.get( contact, getContext())); } else { - viewHolder.contact_picture.setImageBitmap(mBitmapCache.get( - item.getCounterpart(), getContext())); + String name = item.getPresence(); + if (name==null) { + name = item.getCounterpart(); + } + viewHolder.contact_picture.setImageBitmap(mBitmapCache.get(name, getContext())); } viewHolder.contact_picture .setOnClickListener(new OnClickListener() { |