1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-12-24 11:38:00 +01:00

muc: fix roomDestroyed() callback

The previous site where the callback was invoked was only reached if
there was also a user status on the unvailable presence. But those are
not part of unavilable presences upon room destruction.

Fixes SMACK-888.
This commit is contained in:
Florian Schmaus 2020-04-16 21:59:19 +02:00
parent 20aaef2628
commit 0f7b7df1f0

View file

@ -248,6 +248,22 @@ public class MultiUserChat {
listener.left(from);
}
}
Destroy destroy = mucUser.getDestroy();
// The room has been destroyed.
if (destroy != null) {
EntityBareJid alternateMucJid = destroy.getJid();
final MultiUserChat alternateMuc;
if (alternateMucJid == null) {
alternateMuc = null;
} else {
alternateMuc = multiUserChatManager.getMultiUserChat(alternateMucJid);
}
for (UserStatusListener listener : userStatusListeners) {
listener.roomDestroyed(alternateMuc, destroy.getReason());
}
}
}
break;
default:
@ -2471,13 +2487,6 @@ public class MultiUserChat {
listener.nicknameChanged(from, mucUser.getItem().getNick());
}
}
// The room has been destroyed.
if (mucUser.getDestroy() != null) {
MultiUserChat alternateMUC = multiUserChatManager.getMultiUserChat(mucUser.getDestroy().getJid());
for (UserStatusListener listener : userStatusListeners) {
listener.roomDestroyed(alternateMUC, mucUser.getDestroy().getReason());
}
}
}
/**