1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-10-18 12:15:58 +02:00

[muc] Do not invoke userHasLeft() on nickname change

When the incoming unavailable presence is signalling a nickname
change (303), then do not invoke userHasLeft(), because the user
actually does not leave but instead just changes its nickname.

Note that this would also have had fixed SMACK-942, as it would
resolve the deadlock. However, using a dedicated lock for
changeNickname() still seems sensible, and if its just to avoid a bit
of lock contention.

What this also fixes is that a MultiUserChat does no longer invoke its
listener-based callbacks after a nickname change, as previously, after
a nickname change, the userHasLeft() would have been invoked, which
tears down the listeners. This issue was found with
MultiUserChatOccupantIntegrationTest.mucChangeNicknameInformationTest().
This commit is contained in:
Florian Schmaus 2024-05-20 21:45:47 +02:00
parent c34c9bdb62
commit 9447030cd4

View file

@ -258,13 +258,14 @@ public class MultiUserChat {
break;
case unavailable:
occupantsMap.remove(from);
if (mucUser != null && mucUser.hasStatus()) {
if (isUserStatusModification) {
Set<Status> status = mucUser.getStatus();
if (mucUser != null && !status.isEmpty()) {
if (isUserStatusModification && !status.contains(MUCUser.Status.NEW_NICKNAME_303)) {
userHasLeft();
}
// Fire events according to the received presence code
checkPresenceCode(
mucUser.getStatus(),
status,
isUserStatusModification,
mucUser,
from);