1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-12-22 20:47:57 +01:00

Remove duplicate code in MultiUserChat

This commit is contained in:
Florian Schmaus 2017-11-07 20:13:46 +01:00
parent 44e4607259
commit d93d214f0e

View file

@ -737,9 +737,6 @@ public class MultiUserChat {
leavePresence.setTo(JidCreate.fullFrom(room, nickname));
connection.sendStanza(leavePresence);
// Reset occupant information.
occupantsMap.clear();
nickname = null;
joined = false;
userHasLeft();
}
@ -881,9 +878,6 @@ public class MultiUserChat {
connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
// Reset occupant information.
occupantsMap.clear();
nickname = null;
joined = false;
userHasLeft();
}
@ -2024,6 +2018,9 @@ public class MultiUserChat {
* Remove all callbacks and resources necessary when the user has left the room for some reason.
*/
private synchronized void userHasLeft() {
occupantsMap.clear();
nickname = null;
joined = false;
// Update the list of joined rooms
multiUserChatManager.removeJoinedRoom(room);
removeConnectionCallbacks();
@ -2341,14 +2338,11 @@ public class MultiUserChat {
if (statusCodes.contains(Status.KICKED_307)) {
// Check if this occupant was kicked
if (isUserModification) {
joined = false;
for (UserStatusListener listener : userStatusListeners) {
listener.kicked(mucUser.getItem().getActor(), mucUser.getItem().getReason());
}
// Reset occupant information.
occupantsMap.clear();
nickname = null;
userHasLeft();
}
else {