clear muc tiles when avatar of member changes

This commit is contained in:
Daniel Gultsch 2016-06-14 17:11:31 +02:00
parent f9600b950f
commit 49de43b364
3 changed files with 19 additions and 1 deletions

View File

@ -449,7 +449,7 @@ public class MucOptions {
return null; return null;
} }
public User findUserByRealJid(Jid jid) { private User findUserByRealJid(Jid jid) {
if (jid == null) { if (jid == null) {
return null; return null;
} }
@ -463,6 +463,10 @@ public class MucOptions {
return null; return null;
} }
public boolean isContactInRoom(Contact contact) {
return findUserByRealJid(contact.getJid().toBareJid()) != null;
}
public boolean isUserInRoom(Jid jid) { public boolean isUserInRoom(Jid jid) {
return findUserByFullJid(jid) != null; return findUserByFullJid(jid) != null;
} }

View File

@ -99,6 +99,9 @@ public class AvatarService implements OnAdvancedStreamFeaturesLoaded {
key(contact, size)); key(contact, size));
} }
} }
for(Conversation conversation : mXmppConnectionService.findAllConferencesWith(contact)) {
clear(conversation);
}
} }
private String key(Contact contact, int size) { private String key(Contact contact, int size) {

View File

@ -1352,6 +1352,17 @@ public class XmppConnectionService extends Service {
return this.accounts; return this.accounts;
} }
public List<Conversation> findAllConferencesWith(Contact contact) {
ArrayList<Conversation> 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<Conversation> haystack, final Contact contact) { public Conversation find(final Iterable<Conversation> haystack, final Contact contact) {
for (final Conversation conversation : haystack) { for (final Conversation conversation : haystack) {
if (conversation.getContact() == contact) { if (conversation.getContact() == contact) {