diff options
Diffstat (limited to '')
3 files changed, 13 insertions, 5 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/MucOptions.java b/src/main/java/eu/siacs/conversations/entities/MucOptions.java index 853a8408..014a4c98 100644 --- a/src/main/java/eu/siacs/conversations/entities/MucOptions.java +++ b/src/main/java/eu/siacs/conversations/entities/MucOptions.java @@ -302,15 +302,15 @@ public class MucOptions { return hasFeature("muc_moderated"); } - public void deleteUser(String name) { + public User deleteUser(String name) { synchronized (this.users) { for (int i = 0; i < users.size(); ++i) { if (users.get(i).getName().equals(name)) { - users.remove(i); - return; + return users.remove(i); } } } + return null; } public void addUser(User user) { diff --git a/src/main/java/eu/siacs/conversations/parser/PresenceParser.java b/src/main/java/eu/siacs/conversations/parser/PresenceParser.java index b8a2a7e9..d9806dfc 100644 --- a/src/main/java/eu/siacs/conversations/parser/PresenceParser.java +++ b/src/main/java/eu/siacs/conversations/parser/PresenceParser.java @@ -110,7 +110,10 @@ public class PresenceParser extends AbstractParser implements mucOptions.setError(MucOptions.ERROR_UNKNOWN); } } else if (!from.isBareJid()){ - mucOptions.deleteUser(from.getResourcepart()); + MucOptions.User user = mucOptions.deleteUser(from.getResourcepart()); + if (user != null) { + mXmppConnectionService.getAvatarService().clear(user); + } } } else if (type.equals("error")) { Element error = packet.findChild("error"); diff --git a/src/main/java/eu/siacs/conversations/services/AvatarService.java b/src/main/java/eu/siacs/conversations/services/AvatarService.java index be320b6b..276be10d 100644 --- a/src/main/java/eu/siacs/conversations/services/AvatarService.java +++ b/src/main/java/eu/siacs/conversations/services/AvatarService.java @@ -77,7 +77,12 @@ public class AvatarService { avatar = mXmppConnectionService.getFileBackend().getAvatar(user.getAvatar(), size); } if (avatar == null) { - avatar = get(user.getName(), size, cachedOnly); + Contact contact = user.getContact(); + if (contact != null) { + avatar = get(contact, size, cachedOnly); + } else { + avatar = get(user.getName(), size, cachedOnly); + } } this.mXmppConnectionService.getBitmapCache().put(KEY, avatar); return avatar; |