diff options
author | Michael <betheg@bitcloner.org> | 2014-10-05 12:31:49 +0200 |
---|---|---|
committer | Michael <betheg@bitcloner.org> | 2014-10-05 12:31:49 +0200 |
commit | 54e9235bfcbfc22250bd9a14eb8575003856b91d (patch) | |
tree | 7c2ad7f0a1a148aa25c2bd10db524131bd90343d /src/eu/siacs/conversations/entities | |
parent | 5371dd025a3c3b341c061d59f3c3d66cb07c0a2c (diff) |
MUC: differentiated a few more errors.
Diffstat (limited to 'src/eu/siacs/conversations/entities')
-rw-r--r-- | src/eu/siacs/conversations/entities/MucOptions.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/eu/siacs/conversations/entities/MucOptions.java b/src/eu/siacs/conversations/entities/MucOptions.java index 0294c8aa..595d9058 100644 --- a/src/eu/siacs/conversations/entities/MucOptions.java +++ b/src/eu/siacs/conversations/entities/MucOptions.java @@ -15,6 +15,13 @@ public class MucOptions { public static final int ERROR_NICK_IN_USE = 1; public static final int ERROR_ROOM_NOT_FOUND = 2; public static final int ERROR_PASSWORD_REQUIRED = 3; + public static final int ERROR_BANNED = 4; + public static final int ERROR_MEMBERS_ONLY = 5; + + public static final int KICKED_FROM_ROOM = 9; + + public static final String STATUS_CODE_BANNED = "301"; + public static final String STATUS_CODE_KICKED = "307"; public interface OnRenameListener { public void onRename(boolean success); @@ -179,6 +186,18 @@ public class MucOptions { x.getContent())); } } + } else if (type.equals("unavailable") && name.equals(this.joinnick)) { + Element status = packet.findChild("x", + "http://jabber.org/protocol/muc#user").findChild( + "status"); + String code = status.getAttribute("code"); + if (code.equals(STATUS_CODE_KICKED)) { + this.isOnline = false; + this.error = KICKED_FROM_ROOM; + } else if (code.equals(STATUS_CODE_BANNED)) { + this.isOnline = false; + this.error = ERROR_BANNED; + } } else if (type.equals("unavailable")) { deleteUser(packet.getAttribute("from").split("/", 2)[1]); } else if (type.equals("error")) { @@ -199,6 +218,10 @@ public class MucOptions { this.passwordChanged = true; } this.error = ERROR_PASSWORD_REQUIRED; + } else if (error.hasChild("forbidden")) { + this.error = ERROR_BANNED; + } else if (error.hasChild("registration-required")) { + this.error = ERROR_MEMBERS_ONLY; } } } |