Duplicate notifications of Invitation rejection

Hi, we are using Smack 4.2.0 (4.2.0-rc2-49-gb9b8b1a-4.2 2017-03-10)

In an Android client. We find that when deviceA sends an invite to join MUC/conference, and the remote client deviceB rejects the invitation, that our InvitationRejectionListener implmentation is invoked once for each conference room that the deviceA has joined.

So if deviceA is in 3 conference rooms, and deviceB rejects a single invitation, then deviceA shows a rejection dialog 3 times (InvitationRejectionListener is invoked 3 times).

We currently invoke MultiUserChat.removeInvitationRejectionListener(this) once for each conference room joined. We would expect that either a) the listener would be notified only once, or b) only listeners registered on the relevant conference room would be notified.

Please let us know if this is a Smack bug, or if we misundertand the API/intentions.

11:00:58 SENT (0): <message to='one@conference.test.net' from='atest@test.net/ANDROID-355301074232615' id='2Q1Z9-64'><x xmlns='http://jabber.org/protocol/muc#user'><invite to='atest2@test.net'><reason>Come join conference: one@conference.test.net</reason></invite></x></message><r xmlns='urn:xmpp:sm:3'/>

RECV (0): <a xmlns='urn:xmpp:sm:3' h='25' />
<message from="one@conference.test.net" to="atest@test.net"><x xmlns="http://jabber.org/protocol/muc#user"><decline from="atest2@test.net"><reason>Not interested at this time</reason></decline></x></message>



11-06 11:01:00.575 12110-12662/com.test D/ConferenceManager: invitationDeclined: <message to='atest@test.net' from='one@conference.test.net'><thread>d5737f31-ce04-4756-b8ac-a4d903420564</thread><x xmlns='http://jabber.org/protocol/muc#user'><decline from='atest2@test.net'><reason>Not interested at this time</reason></decline></x></message>
11-06 11:01:00.575 12110-12662/com.test W/System.err: java.lang.Throwable: stack dump
11-06 11:01:00.575 12110-12662/com.test W/System.err:     at java.lang.Thread.dumpStack(Thread.java:490)
11-06 11:01:00.575 12110-12662/com.test W/System.err:     at com.test.android.test.ConferenceManager.invitationDeclined(ConferenceManager.java:344)
11-06 11:01:00.575 12110-12662/com.test W/System.err:     at org.jivesoftware.smackx.muc.MultiUserChat.fireInvitationRejectionListeners(MultiUserChat.java:961)
11-06 11:01:00.575 12110-12662/com.test W/System.err:     at org.jivesoftware.smackx.muc.MultiUserChat.access$1200(MultiUserChat.java:104)
11-06 11:01:00.575 12110-12662/com.test W/System.err:     at org.jivesoftware.smackx.muc.MultiUserChat$4.processStanza(MultiUserChat.java:270)
11-06 11:01:00.575 12110-12662/com.test W/System.err:     at org.jivesoftware.smack.AbstractXMPPConnection$5.run(AbstractXMPPConnection.java:1194)
11-06 11:01:00.575 12110-12662/com.test W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
11-06 11:01:00.575 12110-12662/com.test W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
11-06 11:01:00.575 12110-12662/com.test W/System.err:     at java.lang.Thread.run(Thread.java:818)
11-06 11:01:00.575 12110-12662/com.test D/ConferenceManager: invitationDeclined: <message to='atest@test.net' from='one@conference.test.net' id='ee595125394dfe32bb229b01b94ce554f13ebcd8eb35d228704e2e3c5e35d75f'><thread>d5737f31-ce04-4756-b8ac-a4d903420564</thread><x xmlns='http://jabber.org/protocol/muc#user'><decline from='atest2@test.net'><reason>Not interested at this time</reason></decline></x></message>
11-06 11:01:00.575 12110-12662/com.test W/System.err: java.lang.Throwable: stack dump
11-06 11:01:00.575 12110-12662/com.test W/System.err:     at java.lang.Thread.dumpStack(Thread.java:490)
11-06 11:01:00.575 12110-12662/com.test W/System.err:     at com.test.android.test.ConferenceManager.invitationDeclined(ConferenceManager.java:344)
11-06 11:01:00.575 12110-12662/com.test W/System.err:     at org.jivesoftware.smackx.muc.MultiUserChat.fireInvitationRejectionListeners(MultiUserChat.java:961)
11-06 11:01:00.575 12110-12662/com.test W/System.err:     at org.jivesoftware.smackx.muc.MultiUserChat.access$1200(MultiUserChat.java:104)
11-06 11:01:00.575 12110-12662/com.test W/System.err:     at org.jivesoftware.smackx.muc.MultiUserChat$4.processStanza(MultiUserChat.java:270)
11-06 11:01:00.575 12110-12662/com.test W/System.err:     at org.jivesoftware.smack.AbstractXMPPConnection$5.run(AbstractXMPPConnection.java:1194)
11-06 11:01:00.575 12110-12662/com.test W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
11-06 11:01:00.575 12110-12662/com.test W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
11-06 11:01:00.575 12110-12662/com.test W/System.err:     at java.lang.Thread.run(Thread.java:818)

Indeed the listeners filter does not filter by ‘from’ address. I’ve created SMACK-783 to track this. Thanks for reporting.