diff --git a/src/main/java/eu/siacs/conversations/entities/Account.java b/src/main/java/eu/siacs/conversations/entities/Account.java index 7a2dc3f76..002c276e2 100644 --- a/src/main/java/eu/siacs/conversations/entities/Account.java +++ b/src/main/java/eu/siacs/conversations/entities/Account.java @@ -62,7 +62,8 @@ public class Account extends AbstractEntity { REGISTRATION_SUCCESSFUL, REGISTRATION_NOT_SUPPORTED(true), SECURITY_ERROR(true), - INCOMPATIBLE_SERVER(true); + INCOMPATIBLE_SERVER(true), + DNS_TIMEOUT(true); private final boolean isError; @@ -106,6 +107,8 @@ public class Account extends AbstractEntity { return R.string.account_status_security_error; case INCOMPATIBLE_SERVER: return R.string.account_status_incompatible_server; + case DNS_TIMEOUT: + return R.string.account_status_dns_timeout; default: return R.string.account_status_unknown; } diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 8de160580..08d40fcba 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -1881,8 +1881,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa MessagePacket packet = new MessagePacket(); packet.setType(MessagePacket.TYPE_CHAT); packet.setFrom(account.getJid()); - packet.addChild("private", "urn:xmpp:carbons:2"); - packet.addChild("no-copy", "urn:xmpp:hints"); + MessageGenerator.addMessageHints(packet); packet.setAttribute("to", otrSession.getSessionID().getAccountID() + "/" + otrSession.getSessionID().getUserID()); try { diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java index 64507bd67..a65f51fef 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java @@ -165,7 +165,7 @@ public class XmppConnection implements Runnable { } final ArrayList values = result.getParcelableArrayList("values"); if ("timeout".equals(result.getString("error"))) { - throw new IOException("timeout in dns"); + throw new DnsTimeoutException(); } else if (values != null) { int i = 0; boolean socketError = true; @@ -234,6 +234,8 @@ public class XmppConnection implements Runnable { this.changeStatus(Account.State.UNAUTHORIZED); } catch (final UnknownHostException | ConnectException e) { this.changeStatus(Account.State.SERVER_NOT_FOUND); + } catch (final DnsTimeoutException e) { + this.changeStatus(Account.State.DNS_TIMEOUT); } catch (final IOException | XmlPullParserException | NoSuchAlgorithmException e) { Log.d(Config.LOGTAG, account.getJid().toBareJid().toString() + ": " + e.getMessage()); this.changeStatus(Account.State.OFFLINE); @@ -1163,6 +1165,10 @@ public class XmppConnection implements Runnable { } + private class DnsTimeoutException extends IOException { + + } + public class Features { XmppConnection connection; private boolean carbonsEnabled = false; diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index ae2a38dc0..a1394a46c 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -512,4 +512,5 @@ Download failed: Could not connect to host Use white background Show received messages as black text on a white background + Timeout in DNS