1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-25 21:42:07 +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)); leavePresence.setTo(JidCreate.fullFrom(room, nickname));
connection.sendStanza(leavePresence); connection.sendStanza(leavePresence);
// Reset occupant information. // Reset occupant information.
occupantsMap.clear();
nickname = null;
joined = false;
userHasLeft(); userHasLeft();
} }
@ -881,9 +878,6 @@ public class MultiUserChat {
connection.createStanzaCollectorAndSend(iq).nextResultOrThrow(); connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
// Reset occupant information. // Reset occupant information.
occupantsMap.clear();
nickname = null;
joined = false;
userHasLeft(); userHasLeft();
} }
@ -2024,6 +2018,9 @@ public class MultiUserChat {
* Remove all callbacks and resources necessary when the user has left the room for some reason. * Remove all callbacks and resources necessary when the user has left the room for some reason.
*/ */
private synchronized void userHasLeft() { private synchronized void userHasLeft() {
occupantsMap.clear();
nickname = null;
joined = false;
// Update the list of joined rooms // Update the list of joined rooms
multiUserChatManager.removeJoinedRoom(room); multiUserChatManager.removeJoinedRoom(room);
removeConnectionCallbacks(); removeConnectionCallbacks();
@ -2341,14 +2338,11 @@ public class MultiUserChat {
if (statusCodes.contains(Status.KICKED_307)) { if (statusCodes.contains(Status.KICKED_307)) {
// Check if this occupant was kicked // Check if this occupant was kicked
if (isUserModification) { if (isUserModification) {
joined = false;
for (UserStatusListener listener : userStatusListeners) { for (UserStatusListener listener : userStatusListeners) {
listener.kicked(mucUser.getItem().getActor(), mucUser.getItem().getReason()); listener.kicked(mucUser.getItem().getActor(), mucUser.getItem().getReason());
} }
// Reset occupant information. // Reset occupant information.
occupantsMap.clear();
nickname = null;
userHasLeft(); userHasLeft();
} }
else { else {