Leave conference, all contacts set UNAVAILABLE

I am developing an Android XMPP client using Smack 4.2 RC3. I am seeing an issue when leaving a conference. When I invoke MultiUserChat.leave() an UNAVAILABLE presence is sent to the room with my nickname. As an example:

Presence Stanza [to=satnp6@conference.demo.com/test1,from=test1@demo.com/ANDROID-990004820495921,id=c606v-92,type=unavailable,]

Then the packet sending listener in Roster.java is hitting:

connection.addPacketSendingListener(new StanzaListener() {

public void processStanza(Stanza stanzav) throws NotConnectedException, InterruptedException {

Roster.this.setOfflinePresences();

}

}, PresenceTypeFilter.UNAVAILABLE);

And setOfflinePresences() fires my listener for RosterListener.presenceChanged() for all my contacts with UNAVAILABLE. I was not seeing this behavior when I was using 4.2 beta. And it does not seem to be affeced by what server (I see it with Open Fire and ejabberd). It does not appear the server is causing this. I believe this behavior started with commit 1bce31fcd98f17622f1c3a4c734e009252a748fb on Jan 3, 2017

I think the PacketSendingListener above is too tight, and should not match when the local device sends out UNAVAILABLE to a conference. Note I see the same thing when creating a conference room, with a similar stacktrace.

I noticed this around the same time as this bug, but I believe them to be separate

Instant room causing 404

Thanks for the detailed report. This is indeed an unwanted side effect of 1bce31fcd98f17622f1c3a4c734e009252a748fb. I’ve uploaded a new snapshot of 4.2.0-rc3 containing Fix roster handling of outgoing ‘unavailable’ presence · Flowdalic/Smack@85fcb55 · GitHub . Please test and report back if it fixes the issue.

Yes, initial testing looks good. Thanks!