aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/eu/siacs/conversations/entities/MucOptions.java34
-rw-r--r--src/main/java/eu/siacs/conversations/parser/PresenceParser.java22
-rw-r--r--src/main/java/eu/siacs/conversations/services/MessageArchiveService.java1
-rw-r--r--src/main/java/eu/siacs/conversations/services/XmppConnectionService.java4
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ConversationFragment.java27
-rw-r--r--src/main/res/values/strings.xml5
6 files changed, 54 insertions, 39 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/MucOptions.java b/src/main/java/eu/siacs/conversations/entities/MucOptions.java
index be9d790d..3567c14f 100644
--- a/src/main/java/eu/siacs/conversations/entities/MucOptions.java
+++ b/src/main/java/eu/siacs/conversations/entities/MucOptions.java
@@ -91,22 +91,26 @@ public class MucOptions {
}
}
- public static final int ERROR_NO_ERROR = 0;
- public static final int ERROR_NICK_IN_USE = 1;
- public static final int ERROR_UNKNOWN = 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 ERROR_NO_RESPONSE = 6;
-
- public static final int KICKED_FROM_ROOM = 9;
+ public enum Error {
+ NO_RESPONSE,
+ NONE,
+ NICK_IN_USE,
+ PASSWORD_REQUIRED,
+ BANNED,
+ MEMBERS_ONLY,
+ KICKED,
+ SHUTDOWN,
+ UNKNOWN
+ }
public static final String STATUS_CODE_ROOM_CONFIG_CHANGED = "104";
public static final String STATUS_CODE_SELF_PRESENCE = "110";
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_LOST_MEMBERSHIP = "321";
+ public static final String STATUS_CODE_AFFILIATION_CHANGE = "321";
+ public static final String STATUS_CODE_LOST_MEMBERSHIP = "322";
+ public static final String STATUS_CODE_SHUTDOWN = "332";
private interface OnEventListener {
void onSuccess();
@@ -245,7 +249,7 @@ public class MucOptions {
private Data form = new Data();
private Conversation conversation;
private boolean isOnline = false;
- private int error = ERROR_NO_RESPONSE;
+ private Error error = Error.NONE;
public OnRenameListener onRenameListener = null;
private User self;
private String subject = null;
@@ -324,8 +328,8 @@ public class MucOptions {
return findUser(name) != null;
}
- public void setError(int error) {
- this.isOnline = isOnline && error == ERROR_NO_ERROR;
+ public void setError(Error error) {
+ this.isOnline = isOnline && error == Error.NONE;
this.error = error;
}
@@ -379,7 +383,7 @@ public class MucOptions {
return this.isOnline;
}
- public int getError() {
+ public Error getError() {
return this.error;
}
@@ -389,7 +393,7 @@ public class MucOptions {
public void setOffline() {
this.users.clear();
- this.error = ERROR_NO_RESPONSE;
+ this.error = Error.NO_RESPONSE;
this.isOnline = false;
}
diff --git a/src/main/java/eu/siacs/conversations/parser/PresenceParser.java b/src/main/java/eu/siacs/conversations/parser/PresenceParser.java
index dc02eda8..63d28c97 100644
--- a/src/main/java/eu/siacs/conversations/parser/PresenceParser.java
+++ b/src/main/java/eu/siacs/conversations/parser/PresenceParser.java
@@ -63,7 +63,7 @@ public class PresenceParser extends AbstractParser implements
if (x != null) {
Element item = x.findChild("item");
if (item != null && !from.isBareJid()) {
- mucOptions.setError(MucOptions.ERROR_NO_ERROR);
+ mucOptions.setError(MucOptions.Error.NONE);
MucOptions.User user = new MucOptions.User(mucOptions,from);
user.setAffiliation(item.getAttribute("affiliation"));
user.setRole(item.getAttribute("role"));
@@ -109,13 +109,17 @@ public class PresenceParser extends AbstractParser implements
if (codes.contains(MucOptions.STATUS_CODE_CHANGED_NICK)) {
mucOptions.mNickChangingInProgress = true;
} else if (codes.contains(MucOptions.STATUS_CODE_KICKED)) {
- mucOptions.setError(MucOptions.KICKED_FROM_ROOM);
+ mucOptions.setError(MucOptions.Error.KICKED);
} else if (codes.contains(MucOptions.STATUS_CODE_BANNED)) {
- mucOptions.setError(MucOptions.ERROR_BANNED);
+ mucOptions.setError(MucOptions.Error.BANNED);
} else if (codes.contains(MucOptions.STATUS_CODE_LOST_MEMBERSHIP)) {
- mucOptions.setError(MucOptions.ERROR_MEMBERS_ONLY);
+ mucOptions.setError(MucOptions.Error.MEMBERS_ONLY);
+ } else if (codes.contains(MucOptions.STATUS_CODE_AFFILIATION_CHANGE)) {
+ mucOptions.setError(MucOptions.Error.MEMBERS_ONLY);
+ } else if (codes.contains(MucOptions.STATUS_CODE_SHUTDOWN)) {
+ mucOptions.setError(MucOptions.Error.SHUTDOWN);
} else {
- mucOptions.setError(MucOptions.ERROR_UNKNOWN);
+ mucOptions.setError(MucOptions.Error.UNKNOWN);
Log.d(Config.LOGTAG, "unknown error in conference: " + packet);
}
} else if (!from.isBareJid()){
@@ -132,14 +136,14 @@ public class PresenceParser extends AbstractParser implements
mucOptions.onRenameListener.onFailure();
}
} else {
- mucOptions.setError(MucOptions.ERROR_NICK_IN_USE);
+ mucOptions.setError(MucOptions.Error.NICK_IN_USE);
}
} else if (error != null && error.hasChild("not-authorized")) {
- mucOptions.setError(MucOptions.ERROR_PASSWORD_REQUIRED);
+ mucOptions.setError(MucOptions.Error.PASSWORD_REQUIRED);
} else if (error != null && error.hasChild("forbidden")) {
- mucOptions.setError(MucOptions.ERROR_BANNED);
+ mucOptions.setError(MucOptions.Error.BANNED);
} else if (error != null && error.hasChild("registration-required")) {
- mucOptions.setError(MucOptions.ERROR_MEMBERS_ONLY);
+ mucOptions.setError(MucOptions.Error.BANNED);
}
}
}
diff --git a/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java b/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java
index 59a37fe5..e8616bd8 100644
--- a/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java
+++ b/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java
@@ -227,7 +227,6 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded {
this.execute(nextQuery);
this.finalizeQuery(query, false);
synchronized (this.queries) {
- this.queries.remove(query);
this.queries.add(nextQuery);
}
}
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
index b836e780..24a728f7 100644
--- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
@@ -1824,9 +1824,11 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
fetchConferenceConfiguration(conversation);
}
});
-
+ updateConversationUi();
} else {
account.pendingConferenceJoins.add(conversation);
+ conversation.resetMucOptions();
+ updateConversationUi();
}
}
diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
index ac06452a..c652c3c0 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
@@ -809,26 +809,29 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
&& !conversation.getMucOptions().online()
&& account.getStatus() == Account.State.ONLINE) {
switch (conversation.getMucOptions().getError()) {
- case MucOptions.ERROR_NICK_IN_USE:
+ case NICK_IN_USE:
showSnackbar(R.string.nick_in_use, R.string.edit, clickToMuc);
break;
- case MucOptions.ERROR_NO_RESPONSE:
- showSnackbar(R.string.conference_not_found, R.string.leave, leaveMuc);
+ case NO_RESPONSE:
+ showSnackbar(R.string.joining_conference, 0, null);
break;
- case MucOptions.ERROR_PASSWORD_REQUIRED:
+ case PASSWORD_REQUIRED:
showSnackbar(R.string.conference_requires_password, R.string.enter_password, enterPassword);
break;
- case MucOptions.ERROR_BANNED:
+ case BANNED:
showSnackbar(R.string.conference_banned, R.string.leave, leaveMuc);
break;
- case MucOptions.ERROR_MEMBERS_ONLY:
+ case MEMBERS_ONLY:
showSnackbar(R.string.conference_members_only, R.string.leave, leaveMuc);
break;
- case MucOptions.KICKED_FROM_ROOM:
+ case KICKED:
showSnackbar(R.string.conference_kicked, R.string.join, joinMuc);
break;
- case MucOptions.ERROR_UNKNOWN:
- showSnackbar(R.string.conference_unknown_error, R.string.try_again, joinMuc);
+ case UNKNOWN:
+ showSnackbar(R.string.conference_unknown_error, R.string.join, joinMuc);
+ break;
+ case SHUTDOWN:
+ showSnackbar(R.string.conference_shutdown, R.string.join, joinMuc);
break;
default:
break;
@@ -1091,8 +1094,10 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
snackbar.setOnClickListener(null);
snackbarMessage.setText(message);
snackbarMessage.setOnClickListener(null);
- snackbarAction.setVisibility(View.VISIBLE);
- snackbarAction.setText(action);
+ snackbarAction.setVisibility(clickListener == null ? View.GONE : View.VISIBLE);
+ if (action != 0) {
+ snackbarAction.setText(action);
+ }
snackbarAction.setOnClickListener(clickListener);
}
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index acaaf156..48c3de6c 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -241,8 +241,7 @@
<string name="bookmark_already_exists">This bookmark already exists</string>
<string name="you">You</string>
<string name="action_edit_subject">Edit conference subject</string>
- <string name="conference_not_found">Conference not found</string>
- <string name="conference_unknown_error">Unknown error received</string>2
+ <string name="joining_conference">Joining conferenceā€¦</string>
<string name="leave">Leave</string>
<string name="contact_added_you">Contact added you to contact list</string>
<string name="add_back">Add back</string>
@@ -340,6 +339,8 @@
<string name="conference_banned">You are banned from this conference</string>
<string name="conference_members_only">This conference is members only</string>
<string name="conference_kicked">You have been kicked from this conference</string>
+ <string name="conference_shutdown">The conference was shut down</string>
+ <string name="conference_unknown_error">You are no longer in this conference</string>
<string name="using_account">using account %s</string>
<string name="checking_x">Checking %s on HTTP host</string>
<string name="not_connected_try_again">You are not connected. Try again later</string>