aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Account.java5
-rw-r--r--src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java21
-rw-r--r--src/main/res/values/strings.xml1
3 files changed, 19 insertions, 8 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/Account.java b/src/main/java/eu/siacs/conversations/entities/Account.java
index a708b0ce8..2f573c896 100644
--- a/src/main/java/eu/siacs/conversations/entities/Account.java
+++ b/src/main/java/eu/siacs/conversations/entities/Account.java
@@ -99,7 +99,8 @@ public class Account extends AbstractEntity {
INCOMPATIBLE_SERVER(true),
TOR_NOT_AVAILABLE(true),
BIND_FAILURE(true),
- HOST_UNKNOWN(true);
+ HOST_UNKNOWN(true),
+ REGISTRATION_PLEASE_WAIT(true);
private final boolean isError;
@@ -149,6 +150,8 @@ public class Account extends AbstractEntity {
return R.string.account_status_bind_failure;
case HOST_UNKNOWN:
return R.string.account_status_host_unknown;
+ case REGISTRATION_PLEASE_WAIT:
+ return R.string.registration_please_wait;
default:
return R.string.account_status_unknown;
}
diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java
index f75f027b6..9a8a55fbd 100644
--- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java
+++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java
@@ -183,14 +183,21 @@ public class XmppConnection implements Runnable {
account.setOption(Account.OPTION_REGISTER, false);
forceCloseSocket();
changeStatus(Account.State.REGISTRATION_SUCCESSFUL);
- } else if (packet.hasChild("error")
- && (packet.findChild("error").hasChild("conflict"))) {
- forceCloseSocket();
- changeStatus(Account.State.REGISTRATION_CONFLICT);
} else {
- forceCloseSocket();
- changeStatus(Account.State.REGISTRATION_FAILED);
- Log.d(Config.LOGTAG, packet.toString());
+ Element error = packet.findChild("error");
+ if (error != null && error.hasChild("conflict")) {
+ forceCloseSocket();
+ changeStatus(Account.State.REGISTRATION_CONFLICT);
+ } else if (error != null
+ && "wait".equals(error.getAttribute("type"))
+ && error.hasChild("resource-constraint")) {
+ forceCloseSocket();
+ changeStatus(Account.State.REGISTRATION_PLEASE_WAIT);
+ } else {
+ forceCloseSocket();
+ changeStatus(Account.State.REGISTRATION_FAILED);
+ Log.d(Config.LOGTAG, packet.toString());
+ }
}
}
};
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index aa5f5a386..f50c3a70b 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -641,4 +641,5 @@
<string name="secure_password_generated">A secure password has been generated</string>
<string name="device_does_not_support_battery_op">Your device does not support opting out of battery optimization</string>
<string name="show_password">Show password</string>
+ <string name="registration_please_wait">Registration failed: Try again later</string>
</resources>