change status codes string 'number' to a better readable constant.

This commit is contained in:
Michael 2014-11-20 21:31:29 +01:00
parent a207240881
commit 3e3767cb06

View file

@ -24,7 +24,9 @@ public class MucOptions {
public static final int KICKED_FROM_ROOM = 9; public static final int KICKED_FROM_ROOM = 9;
public static final String STATUS_CODE_SELF_PRESENCE = "110";
public static final String STATUS_CODE_BANNED = "301"; public static final String STATUS_CODE_BANNED = "301";
public static final String STATUS_CODE_CHANGED_NICK = "303";
public static final String STATUS_CODE_KICKED = "307"; public static final String STATUS_CODE_KICKED = "307";
private interface OnEventListener { private interface OnEventListener {
@ -178,7 +180,7 @@ public class MucOptions {
user.setAffiliation(item.getAttribute("affiliation")); user.setAffiliation(item.getAttribute("affiliation"));
user.setRole(item.getAttribute("role")); user.setRole(item.getAttribute("role"));
user.setJid(item.getAttributeAsJid("jid")); user.setJid(item.getAttributeAsJid("jid"));
if (codes.contains("110")) { if (codes.contains(STATUS_CODE_SELF_PRESENCE)) {
this.isOnline = true; this.isOnline = true;
this.error = ERROR_NO_ERROR; this.error = ERROR_NO_ERROR;
self = user; self = user;
@ -208,8 +210,8 @@ public class MucOptions {
} }
} }
} }
} else if (type.equals("unavailable") && codes.contains("110")) { } else if (type.equals("unavailable") && codes.contains(STATUS_CODE_SELF_PRESENCE)) {
if (codes.contains("303")) { if (codes.contains(STATUS_CODE_CHANGED_NICK)) {
this.mNickChangingInProgress = true; this.mNickChangingInProgress = true;
} else if (codes.contains(STATUS_CODE_KICKED)) { } else if (codes.contains(STATUS_CODE_KICKED)) {
setError(KICKED_FROM_ROOM); setError(KICKED_FROM_ROOM);