From bdb8d98eb130b64cd2482e462a7a0dd035f92fbc Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Mon, 8 Oct 2018 10:31:11 +0200 Subject: [PATCH] show snackbar for remote server timeout in mucs --- .../java/eu/siacs/conversations/entities/MucOptions.java | 1 + .../java/eu/siacs/conversations/parser/PresenceParser.java | 2 ++ .../eu/siacs/conversations/ui/ConversationFragment.java | 7 +++++++ src/main/res/values/strings.xml | 1 + 4 files changed, 11 insertions(+) diff --git a/src/main/java/eu/siacs/conversations/entities/MucOptions.java b/src/main/java/eu/siacs/conversations/entities/MucOptions.java index ef2e7243c..631987706 100644 --- a/src/main/java/eu/siacs/conversations/entities/MucOptions.java +++ b/src/main/java/eu/siacs/conversations/entities/MucOptions.java @@ -644,6 +644,7 @@ public class MucOptions { public enum Error { NO_RESPONSE, SERVER_NOT_FOUND, + REMOTE_SERVER_TIMEOUT, NONE, NICK_IN_USE, PASSWORD_REQUIRED, diff --git a/src/main/java/eu/siacs/conversations/parser/PresenceParser.java b/src/main/java/eu/siacs/conversations/parser/PresenceParser.java index 1208c2113..201ea1c94 100644 --- a/src/main/java/eu/siacs/conversations/parser/PresenceParser.java +++ b/src/main/java/eu/siacs/conversations/parser/PresenceParser.java @@ -188,6 +188,8 @@ public class PresenceParser extends AbstractParser implements mucOptions.setError(MucOptions.Error.MEMBERS_ONLY); } else if (error.hasChild("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")) { final String gone = error.findChildContent("gone"); final Jid alternate; diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index 6b63ac0f2..f1f8a44e8 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -2111,6 +2111,13 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke showSnackbar(R.string.remote_server_not_found, R.string.leave, leaveMuc); } 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: showSnackbar(R.string.conference_requires_password, R.string.enter_password, enterPassword); break; diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index a729a134d..7876525ba 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -561,6 +561,7 @@ Allow No permission to access %s Remote server not found + Remote server timeout Unable to update account Report this JID as sending unwanted messages. Delete OMEMO identities