From 92ad4cb73650b95f0888afabe60f179d282e4e06 Mon Sep 17 00:00:00 2001 From: iNPUTmice Date: Thu, 20 Nov 2014 22:44:31 +0100 Subject: changed listener timing and cache clearing after muc presences --- .../eu/siacs/conversations/parser/PresenceParser.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/main/java/eu/siacs/conversations/parser/PresenceParser.java b/src/main/java/eu/siacs/conversations/parser/PresenceParser.java index 635f2932..8b367970 100644 --- a/src/main/java/eu/siacs/conversations/parser/PresenceParser.java +++ b/src/main/java/eu/siacs/conversations/parser/PresenceParser.java @@ -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); } } } -- cgit v1.2.3