diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/eu/siacs/conversations/parser/PresenceParser.java | 15 |
1 files changed, 9 insertions, 6 deletions
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); } } } |