aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-10-06 13:34:19 +0200
committeriNPUTmice <daniel@gultsch.de>2014-10-06 13:34:19 +0200
commit16d5429f803dfa6e76110dd83e8f04377358f839 (patch)
treea3110212d42ff78018c95f8d02bbb7b799293d2a /src
parentb788b84c31bc53feb659e1af4dcaad98396c2de7 (diff)
muc options clean up
Diffstat (limited to 'src')
-rw-r--r--src/eu/siacs/conversations/entities/MucOptions.java45
-rw-r--r--src/eu/siacs/conversations/ui/ConversationFragment.java10
2 files changed, 28 insertions, 27 deletions
diff --git a/src/eu/siacs/conversations/entities/MucOptions.java b/src/eu/siacs/conversations/entities/MucOptions.java
index a9d568486..12ea4e931 100644
--- a/src/eu/siacs/conversations/entities/MucOptions.java
+++ b/src/eu/siacs/conversations/entities/MucOptions.java
@@ -115,7 +115,6 @@ public class MucOptions {
private String subject = null;
private String joinnick;
private String password = null;
- private boolean passwordChanged = false;
public MucOptions(Account account) {
this.account = account;
@@ -165,9 +164,6 @@ public class MucOptions {
}
aboutToRename = false;
}
- if (conversation.getBookmark() != null) {
- this.passwordChanged = false;
- }
} else {
addUser(user);
}
@@ -186,22 +182,26 @@ public class MucOptions {
}
}
} 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;
+ Element x = packet.findChild("x",
+ "http://jabber.org/protocol/muc#user");
+ if (x != null) {
+ Element status = x.findChild("status");
+ if (status != null) {
+ String code = status.getAttribute("code");
+ if (STATUS_CODE_KICKED.equals(code)) {
+ this.isOnline = false;
+ this.error = KICKED_FROM_ROOM;
+ } else if (STATUS_CODE_BANNED.equals(code)) {
+ this.isOnline = false;
+ this.error = ERROR_BANNED;
+ }
+ }
}
} else if (type.equals("unavailable")) {
deleteUser(packet.getAttribute("from").split("/", 2)[1]);
} else if (type.equals("error")) {
Element error = packet.findChild("error");
- if (error.hasChild("conflict")) {
+ if (error != null && error.hasChild("conflict")) {
if (aboutToRename) {
if (renameListener != null) {
renameListener.onRename(false);
@@ -211,14 +211,12 @@ public class MucOptions {
} else {
this.error = ERROR_NICK_IN_USE;
}
- } else if (error.hasChild("not-authorized")) {
- if (conversation.getBookmark() != null) {
- this.passwordChanged = true;
- }
+ } else if (error != null && error.hasChild("not-authorized")) {
this.error = ERROR_PASSWORD_REQUIRED;
- } else if (error.hasChild("forbidden")) {
+ } else if (error != null && error.hasChild("forbidden")) {
this.error = ERROR_BANNED;
- } else if (error.hasChild("registration-required")) {
+ } else if (error != null
+ && error.hasChild("registration-required")) {
this.error = ERROR_MEMBERS_ONLY;
}
}
@@ -363,9 +361,4 @@ public class MucOptions {
conversation
.setAttribute(Conversation.ATTRIBUTE_MUC_PASSWORD, password);
}
-
- public boolean isPasswordChanged2() {
- return this.passwordChanged;
- }
-
} \ No newline at end of file
diff --git a/src/eu/siacs/conversations/ui/ConversationFragment.java b/src/eu/siacs/conversations/ui/ConversationFragment.java
index 2fa6b4544..716e299ef 100644
--- a/src/eu/siacs/conversations/ui/ConversationFragment.java
+++ b/src/eu/siacs/conversations/ui/ConversationFragment.java
@@ -131,6 +131,14 @@ public class ConversationFragment extends Fragment {
activity.endConversation(conversation);
}
};
+
+ private OnClickListener joinMuc = new OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ activity.xmppConnectionService.joinMuc(conversation);
+ }
+ };
private OnClickListener enterPassword = new OnClickListener() {
@@ -495,7 +503,7 @@ public class ConversationFragment extends Fragment {
break;
case MucOptions.KICKED_FROM_ROOM:
showSnackbar(R.string.conference_kicked,
- R.string.leave, leaveMuc);
+ R.string.join, joinMuc);
break;
default:
break;