aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2016-08-19 21:47:08 +0200
committerChristian Schneppe <christian@pix-art.de>2016-08-26 19:44:51 +0200
commit89dd22d279754cf8a04c588ff6d61bc1fed1cf38 (patch)
tree5e31e9107c5d25de64fcd5e5d670573e32ab4306 /src
parent192201c481dd6ad837afeb83032fdd685d4ff8e3 (diff)
display error status for missing internet permission
Diffstat (limited to 'src')
-rw-r--r--src/main/java/de/pixart/messenger/entities/Account.java5
-rw-r--r--src/main/java/de/pixart/messenger/xmpp/XmppConnection.java14
-rw-r--r--src/main/res/values/strings.xml1
3 files changed, 13 insertions, 7 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/Account.java b/src/main/java/de/pixart/messenger/entities/Account.java
index 3a479dc6e..bd5555201 100644
--- a/src/main/java/de/pixart/messenger/entities/Account.java
+++ b/src/main/java/de/pixart/messenger/entities/Account.java
@@ -111,7 +111,8 @@ public class Account extends AbstractEntity {
STREAM_ERROR(true),
POLICY_VIOLATION(true),
REGISTRATION_PASSWORD_TOO_WEAK(true),
- PAYMENT_REQUIRED(true);
+ PAYMENT_REQUIRED(true),
+ MISSING_INTERNET_PERMISSION(true);
private final boolean isError;
@@ -171,6 +172,8 @@ public class Account extends AbstractEntity {
return R.string.account_status_stream_error;
case PAYMENT_REQUIRED:
return R.string.payment_required;
+ case MISSING_INTERNET_PERMISSION:
+ return R.string.missing_internet_permission;
default:
return R.string.account_status_unknown;
}
diff --git a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
index 081f8975c..b0a91af99 100644
--- a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
+++ b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
@@ -297,7 +297,7 @@ public class XmppConnection implements Runnable {
socket = tlsFactoryVerifier.factory.createSocket();
socket.connect(address, Config.SOCKET_TIMEOUT * 1000);
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");
throw new SecurityException();
}
@@ -323,10 +323,10 @@ public class XmppConnection implements Runnable {
startXmpp();
} else {
final Bundle result = DNSHelper.getSRVRecord(account.getServer(), mXmppConnectionService);
- final ArrayList<Parcelable>values = result.getParcelableArrayList("values");
- for(Iterator<Parcelable> iterator = values.iterator(); iterator.hasNext();) {
+ final ArrayList<Parcelable> values = result.getParcelableArrayList("values");
+ for (Iterator<Parcelable> iterator = values.iterator(); iterator.hasNext(); ) {
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;
}
final Bundle namePort = (Bundle) iterator.next();
@@ -380,10 +380,10 @@ public class XmppConnection implements Runnable {
if (startXmpp())
break; // successfully connected to server that speaks xmpp
- } catch(final SecurityException e) {
+ } catch (final SecurityException e) {
throw 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()) {
throw new UnknownHostException();
}
@@ -391,6 +391,8 @@ public class XmppConnection implements Runnable {
}
}
processStream();
+ } catch (final java.lang.SecurityException e) {
+ this.changeStatus(Account.State.MISSING_INTERNET_PERMISSION);
} catch (final IncompatibleServerException e) {
this.changeStatus(Account.State.INCOMPATIBLE_SERVER);
} catch (final SecurityException e) {
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index baec6bad6..984510da6 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -686,4 +686,5 @@
<string name="pref_export_plain_text_logs_summary">Enable an export of chat logs as human readable text files</string>
<string name="pref_export_plain_text_logs">Export human readable chat logs</string>
<string name="payment_required">Payment required</string>
+ <string name="missing_internet_permission">Missing internet permission</string>
</resources>