report bind failure as account state
This commit is contained in:
parent
0157039e87
commit
a7cd05bd4e
|
@ -93,7 +93,8 @@ public class Account extends AbstractEntity {
|
|||
REGISTRATION_NOT_SUPPORTED(true),
|
||||
SECURITY_ERROR(true),
|
||||
INCOMPATIBLE_SERVER(true),
|
||||
TOR_NOT_AVAILABLE(true);
|
||||
TOR_NOT_AVAILABLE(true),
|
||||
BIND_FAILURE(true);
|
||||
|
||||
private final boolean isError;
|
||||
|
||||
|
@ -139,6 +140,8 @@ public class Account extends AbstractEntity {
|
|||
return R.string.account_status_incompatible_server;
|
||||
case TOR_NOT_AVAILABLE:
|
||||
return R.string.account_status_tor_unavailable;
|
||||
case BIND_FAILURE:
|
||||
return R.string.account_status_bind_failure;
|
||||
default:
|
||||
return R.string.account_status_unknown;
|
||||
}
|
||||
|
|
|
@ -906,22 +906,23 @@ public class XmppConnection implements Runnable {
|
|||
if (jid != null && jid.getContent() != null) {
|
||||
try {
|
||||
account.setResource(Jid.fromString(jid.getContent()).getResourcepart());
|
||||
if (streamFeatures.hasChild("session")) {
|
||||
sendStartSession();
|
||||
} else {
|
||||
sendPostBindInitialization();
|
||||
}
|
||||
return;
|
||||
} catch (final InvalidJidException e) {
|
||||
// TODO: Handle the case where an external JID is technically invalid?
|
||||
}
|
||||
if (streamFeatures.hasChild("session")) {
|
||||
sendStartSession();
|
||||
} else {
|
||||
sendPostBindInitialization();
|
||||
Log.d(Config.LOGTAG,account.getJid().toBareJid()+": server reported invalid jid ("+jid.getContent()+") on bind");
|
||||
}
|
||||
} else {
|
||||
Log.d(Config.LOGTAG, account.getJid() + ": disconnecting because of bind failure. (no jid)");
|
||||
disconnect(true);
|
||||
}
|
||||
} else {
|
||||
Log.d(Config.LOGTAG, account.getJid() + ": disconnecting because of bind failure (" + packet.toString());
|
||||
disconnect(true);
|
||||
}
|
||||
forceCloseSocket();
|
||||
changeStatus(Account.State.BIND_FAILURE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -541,6 +541,7 @@
|
|||
<string name="pref_use_white_background">Use white background</string>
|
||||
<string name="pref_use_white_background_summary">Show received messages as black text on a white background</string>
|
||||
<string name="account_status_tor_unavailable">Tor network unavailable</string>
|
||||
<string name="account_status_bind_failure">Bind failure</string>
|
||||
<string name="server_info_broken">Broken</string>
|
||||
<string name="pref_presence_settings">Presence</string>
|
||||
<string name="pref_away_when_screen_off">Away when screen is off</string>
|
||||
|
|
Loading…
Reference in a new issue