display error status for missing internet permission
This commit is contained in:
parent
cf909afc60
commit
285d86b375
|
@ -112,7 +112,8 @@ public class Account extends AbstractEntity {
|
||||||
STREAM_ERROR(true),
|
STREAM_ERROR(true),
|
||||||
POLICY_VIOLATION(true),
|
POLICY_VIOLATION(true),
|
||||||
REGISTRATION_PASSWORD_TOO_WEAK(true),
|
REGISTRATION_PASSWORD_TOO_WEAK(true),
|
||||||
PAYMENT_REQUIRED(true);
|
PAYMENT_REQUIRED(true),
|
||||||
|
MISSING_INTERNET_PERMISSION(true);
|
||||||
|
|
||||||
private final boolean isError;
|
private final boolean isError;
|
||||||
|
|
||||||
|
@ -172,6 +173,8 @@ public class Account extends AbstractEntity {
|
||||||
return R.string.account_status_stream_error;
|
return R.string.account_status_stream_error;
|
||||||
case PAYMENT_REQUIRED:
|
case PAYMENT_REQUIRED:
|
||||||
return R.string.payment_required;
|
return R.string.payment_required;
|
||||||
|
case MISSING_INTERNET_PERMISSION:
|
||||||
|
return R.string.missing_internet_permission;
|
||||||
default:
|
default:
|
||||||
return R.string.account_status_unknown;
|
return R.string.account_status_unknown;
|
||||||
}
|
}
|
||||||
|
|
|
@ -284,7 +284,7 @@ public class XmppConnection implements Runnable {
|
||||||
socket = tlsFactoryVerifier.factory.createSocket();
|
socket = tlsFactoryVerifier.factory.createSocket();
|
||||||
socket.connect(address, Config.SOCKET_TIMEOUT * 1000);
|
socket.connect(address, Config.SOCKET_TIMEOUT * 1000);
|
||||||
final SSLSession session = ((SSLSocket) socket).getSession();
|
final SSLSession session = ((SSLSocket) socket).getSession();
|
||||||
if (!tlsFactoryVerifier.verifier.verify(account.getServer().getDomainpart(),session)) {
|
if (!tlsFactoryVerifier.verifier.verify(account.getServer().getDomainpart(), session)) {
|
||||||
Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": TLS certificate verification failed");
|
Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": TLS certificate verification failed");
|
||||||
throw new SecurityException();
|
throw new SecurityException();
|
||||||
}
|
}
|
||||||
|
@ -310,10 +310,10 @@ public class XmppConnection implements Runnable {
|
||||||
startXmpp();
|
startXmpp();
|
||||||
} else {
|
} else {
|
||||||
final Bundle result = DNSHelper.getSRVRecord(account.getServer(), mXmppConnectionService);
|
final Bundle result = DNSHelper.getSRVRecord(account.getServer(), mXmppConnectionService);
|
||||||
final ArrayList<Parcelable>values = result.getParcelableArrayList("values");
|
final ArrayList<Parcelable> values = result.getParcelableArrayList("values");
|
||||||
for(Iterator<Parcelable> iterator = values.iterator(); iterator.hasNext();) {
|
for (Iterator<Parcelable> iterator = values.iterator(); iterator.hasNext(); ) {
|
||||||
if (Thread.currentThread().isInterrupted()) {
|
if (Thread.currentThread().isInterrupted()) {
|
||||||
Log.d(Config.LOGTAG,account.getJid().toBareJid()+": Thread was interrupted");
|
Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": Thread was interrupted");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final Bundle namePort = (Bundle) iterator.next();
|
final Bundle namePort = (Bundle) iterator.next();
|
||||||
|
@ -367,10 +367,10 @@ public class XmppConnection implements Runnable {
|
||||||
|
|
||||||
if (startXmpp())
|
if (startXmpp())
|
||||||
break; // successfully connected to server that speaks xmpp
|
break; // successfully connected to server that speaks xmpp
|
||||||
} catch(final SecurityException e) {
|
} catch (final SecurityException e) {
|
||||||
throw e;
|
throw e;
|
||||||
} catch (final Throwable e) {
|
} catch (final Throwable e) {
|
||||||
Log.d(Config.LOGTAG, account.getJid().toBareJid().toString() + ": " + e.getMessage() +"("+e.getClass().getName()+")");
|
Log.d(Config.LOGTAG, account.getJid().toBareJid().toString() + ": " + e.getMessage() + "(" + e.getClass().getName() + ")");
|
||||||
if (!iterator.hasNext()) {
|
if (!iterator.hasNext()) {
|
||||||
throw new UnknownHostException();
|
throw new UnknownHostException();
|
||||||
}
|
}
|
||||||
|
@ -378,6 +378,8 @@ public class XmppConnection implements Runnable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
processStream();
|
processStream();
|
||||||
|
} catch (final java.lang.SecurityException e) {
|
||||||
|
this.changeStatus(Account.State.MISSING_INTERNET_PERMISSION);
|
||||||
} catch (final IncompatibleServerException e) {
|
} catch (final IncompatibleServerException e) {
|
||||||
this.changeStatus(Account.State.INCOMPATIBLE_SERVER);
|
this.changeStatus(Account.State.INCOMPATIBLE_SERVER);
|
||||||
} catch (final SecurityException e) {
|
} catch (final SecurityException e) {
|
||||||
|
|
|
@ -675,4 +675,5 @@
|
||||||
<string name="type_web">Web browser</string>
|
<string name="type_web">Web browser</string>
|
||||||
<string name="type_console">Console</string>
|
<string name="type_console">Console</string>
|
||||||
<string name="payment_required">Payment required</string>
|
<string name="payment_required">Payment required</string>
|
||||||
|
<string name="missing_internet_permission">Missing internet permission</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in New Issue