From 7099c55a67caf7466dd43bf5c1c1553916770cbc Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 14 Jun 2016 17:11:31 +0200 Subject: clear muc tiles when avatar of member changes --- src/main/java/eu/siacs/conversations/entities/MucOptions.java | 6 +++++- .../java/eu/siacs/conversations/services/AvatarService.java | 3 +++ .../siacs/conversations/services/XmppConnectionService.java | 11 +++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/entities/MucOptions.java b/src/main/java/eu/siacs/conversations/entities/MucOptions.java index cafcf14fd..bdbe94146 100644 --- a/src/main/java/eu/siacs/conversations/entities/MucOptions.java +++ b/src/main/java/eu/siacs/conversations/entities/MucOptions.java @@ -448,7 +448,7 @@ public class MucOptions { return null; } - public User findUserByRealJid(Jid jid) { + private User findUserByRealJid(Jid jid) { if (jid == null) { return null; } @@ -462,6 +462,10 @@ public class MucOptions { return null; } + public boolean isContactInRoom(Contact contact) { + return findUserByRealJid(contact.getJid().toBareJid()) != null; + } + public boolean isUserInRoom(Jid jid) { return findUserByFullJid(jid) != null; } diff --git a/src/main/java/eu/siacs/conversations/services/AvatarService.java b/src/main/java/eu/siacs/conversations/services/AvatarService.java index 88071f500..ea71ff047 100644 --- a/src/main/java/eu/siacs/conversations/services/AvatarService.java +++ b/src/main/java/eu/siacs/conversations/services/AvatarService.java @@ -99,6 +99,9 @@ public class AvatarService implements OnAdvancedStreamFeaturesLoaded { key(contact, size)); } } + for(Conversation conversation : mXmppConnectionService.findAllConferencesWith(contact)) { + clear(conversation); + } } private String key(Contact contact, int size) { diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 3072a9aad..6f173ba25 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -1347,6 +1347,17 @@ public class XmppConnectionService extends Service { return this.accounts; } + public List findAllConferencesWith(Contact contact) { + ArrayList results = new ArrayList<>(); + for(Conversation conversation : conversations) { + if (conversation.getMode() == Conversation.MODE_MULTI + && conversation.getMucOptions().isContactInRoom(contact)) { + results.add(conversation); + } + } + return results; + } + public Conversation find(final Iterable haystack, final Contact contact) { for (final Conversation conversation : haystack) { if (conversation.getContact() == contact) { -- cgit v1.2.3