changed listener timing and cache clearing after muc presences

This commit is contained in:
iNPUTmice 2014-11-20 22:44:31 +01:00
parent 66abdfccd4
commit 92ad4cb736

View File

@ -4,6 +4,7 @@ import eu.siacs.conversations.crypto.PgpEngine;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Contact;
import eu.siacs.conversations.entities.Conversation;
import eu.siacs.conversations.entities.MucOptions;
import eu.siacs.conversations.entities.Presences;
import eu.siacs.conversations.generator.PresenceGenerator;
import eu.siacs.conversations.services.XmppConnectionService;
@ -34,15 +35,17 @@ public class PresenceParser extends AbstractParser implements
mXmppConnectionService.getAvatarService().clear(muc);
}
} else if (packet.hasChild("x", "http://jabber.org/protocol/muc")) {
final Conversation muc = mXmppConnectionService.find(account,
final Conversation conversation = mXmppConnectionService.find(account,
packet.getFrom().toBareJid());
if (muc != null) {
boolean before = muc.getMucOptions().online();
muc.getMucOptions().processPacket(packet, mPgpEngine);
if (before != muc.getMucOptions().online()) {
if (conversation != null) {
final MucOptions mucOptions = conversation.getMucOptions();
boolean before = mucOptions.online();
int count = mucOptions.getUsers().size();
mucOptions.processPacket(packet, mPgpEngine);
mXmppConnectionService.getAvatarService().clear(conversation);
if (before != mucOptions.online() || (mucOptions.online() && count != mucOptions.getUsers().size())) {
mXmppConnectionService.updateConversationUi();
}
mXmppConnectionService.getAvatarService().clear(muc);
}
}
}