From e1d2c32e63d6f2276b56600945569dede3e34890 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 6 Sep 2016 12:15:08 +0200 Subject: [PATCH] show server not found muc error --- .../java/eu/siacs/conversations/entities/MucOptions.java | 1 + .../conversations/services/XmppConnectionService.java | 8 ++++++-- .../eu/siacs/conversations/ui/ConversationFragment.java | 3 +++ src/main/res/values/strings.xml | 1 + 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/entities/MucOptions.java b/src/main/java/eu/siacs/conversations/entities/MucOptions.java index 0ae8b279a..097f4e301 100644 --- a/src/main/java/eu/siacs/conversations/entities/MucOptions.java +++ b/src/main/java/eu/siacs/conversations/entities/MucOptions.java @@ -116,6 +116,7 @@ public class MucOptions { public enum Error { NO_RESPONSE, + SEVRER_NOT_FOUND, NONE, NICK_IN_USE, PASSWORD_REQUIRED, diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index d0f2754cb..337c0b4d2 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -2028,8 +2028,12 @@ public class XmppConnectionService extends Service { @Override public void onFetchFailed(final Conversation conversation, Element error) { - join(conversation); - fetchConferenceConfiguration(conversation); + if (error != null && "remote-server-not-found".equals(error.getName())) { + conversation.getMucOptions().setError(MucOptions.Error.SEVRER_NOT_FOUND); + } else { + join(conversation); + fetchConferenceConfiguration(conversation); + } } }); updateConversationUi(); diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index ad3ca4ea2..5fd654fa9 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -865,6 +865,9 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa case NO_RESPONSE: showSnackbar(R.string.joining_conference, 0, null); break; + case SEVRER_NOT_FOUND: + showSnackbar(R.string.remote_server_not_found,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 130987165..dbc4ab378 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -680,4 +680,5 @@ Contact asks for presence subscription Allow No permission to access %s + Remote server not found