1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-10 17:49:38 +02:00

Use switch-case for Presence.getType()

This commit is contained in:
Florian Schmaus 2014-12-22 16:12:34 +01:00
parent 469548f53a
commit 7874daa59b
2 changed files with 31 additions and 23 deletions

View file

@ -159,7 +159,8 @@ public class MultiUserChat {
String from = presence.getFrom();
String myRoomJID = MultiUserChat.this.room + "/" + nickname;
boolean isUserStatusModification = presence.getFrom().equals(myRoomJID);
if (presence.getType() == Presence.Type.available) {
switch (presence.getType()) {
case available:
Presence oldPresence = occupantsMap.put(from, presence);
if (oldPresence != null) {
// Get the previous occupant's affiliation & role
@ -187,8 +188,8 @@ public class MultiUserChat {
}
}
}
}
else if (presence.getType() == Presence.Type.unavailable) {
break;
case unavailable:
occupantsMap.remove(from);
MUCUser mucUser = MUCUser.from(packet);
if (mucUser != null && mucUser.getStatus() != null) {
@ -206,6 +207,9 @@ public class MultiUserChat {
}
}
}
break;
default:
break;
}
for (PresenceListener listener : presenceListeners) {
listener.processPresence(presence);