Adds a packet listener that will be notified of any new Presence packets sent to the group chat. Using a listener is a suitable way to know when the list of occupants should be re-loaded due to any changes.
However, this is not true. Because it's not guaranteed that smacks built-in PacketListener is called before the custom PacketListener from the user and therefore has a chance to update e.g. the occupant count or the list of occupants. It may be guaranteed if was fixed.
I think the best solution would be to add an callback method to MUC that is invoked every time a presence in the MUC has changed (e.g. join, leave, status change) and these change has be propagated to the MUC instances. internal state.
The javadoc of addPacketListener should then be fixed by removing the statement "...is a suitable way to know when the list of occupants should be re-loaded due to any changes."
MultiUserChat.addParticipantListener javadoc currently states
However, this is not true. Because it's not guaranteed that smacks built-in PacketListener is called before the custom PacketListener from the user and therefore has a chance to update e.g. the occupant count or the list of occupants. It may be guaranteed if was fixed.
I think the best solution would be to add an callback method to MUC that is invoked every time a presence in the MUC has changed (e.g. join, leave, status change) and these change has be propagated to the MUC instances. internal state.
The javadoc of addPacketListener should then be fixed by removing the statement "...is a suitable way to know when the list of occupants should be re-loaded due to any changes."
See also the Stackoverflow question which is the origin of this bug report.