show snackbar for remote server timeout in mucs

This commit is contained in:
Daniel Gultsch 2018-10-08 10:31:11 +02:00
parent de0741bdf7
commit bdb8d98eb1
4 changed files with 11 additions and 0 deletions

View File

@ -644,6 +644,7 @@ public class MucOptions {
public enum Error { public enum Error {
NO_RESPONSE, NO_RESPONSE,
SERVER_NOT_FOUND, SERVER_NOT_FOUND,
REMOTE_SERVER_TIMEOUT,
NONE, NONE,
NICK_IN_USE, NICK_IN_USE,
PASSWORD_REQUIRED, PASSWORD_REQUIRED,

View File

@ -188,6 +188,8 @@ public class PresenceParser extends AbstractParser implements
mucOptions.setError(MucOptions.Error.MEMBERS_ONLY); mucOptions.setError(MucOptions.Error.MEMBERS_ONLY);
} else if (error.hasChild("resource-constraint")) { } else if (error.hasChild("resource-constraint")) {
mucOptions.setError(MucOptions.Error.RESOURCE_CONSTRAINT); mucOptions.setError(MucOptions.Error.RESOURCE_CONSTRAINT);
} else if (error.hasChild("remote-server-timeout")) {
mucOptions.setError(MucOptions.Error.REMOTE_SERVER_TIMEOUT);
} else if (error.hasChild("gone")) { } else if (error.hasChild("gone")) {
final String gone = error.findChildContent("gone"); final String gone = error.findChildContent("gone");
final Jid alternate; final Jid alternate;

View File

@ -2111,6 +2111,13 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
showSnackbar(R.string.remote_server_not_found, R.string.leave, leaveMuc); showSnackbar(R.string.remote_server_not_found, R.string.leave, leaveMuc);
} }
break; break;
case REMOTE_SERVER_TIMEOUT:
if (conversation.receivedMessagesCount() > 0) {
showSnackbar(R.string.remote_server_timeout, R.string.try_again, joinMuc);
} else {
showSnackbar(R.string.remote_server_timeout, R.string.leave, leaveMuc);
}
break;
case PASSWORD_REQUIRED: case PASSWORD_REQUIRED:
showSnackbar(R.string.conference_requires_password, R.string.enter_password, enterPassword); showSnackbar(R.string.conference_requires_password, R.string.enter_password, enterPassword);
break; break;

View File

@ -561,6 +561,7 @@
<string name="allow">Allow</string> <string name="allow">Allow</string>
<string name="no_permission_to_access_x">No permission to access %s</string> <string name="no_permission_to_access_x">No permission to access %s</string>
<string name="remote_server_not_found">Remote server not found</string> <string name="remote_server_not_found">Remote server not found</string>
<string name="remote_server_timeout">Remote server timeout</string>
<string name="unable_to_update_account">Unable to update account</string> <string name="unable_to_update_account">Unable to update account</string>
<string name="report_jid_as_spammer">Report this JID as sending unwanted messages.</string> <string name="report_jid_as_spammer">Report this JID as sending unwanted messages.</string>
<string name="pref_delete_omemo_identities">Delete OMEMO identities</string> <string name="pref_delete_omemo_identities">Delete OMEMO identities</string>