aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2015-12-01 22:41:58 +0100
committerDaniel Gultsch <daniel@gultsch.de>2015-12-01 22:41:58 +0100
commitdc8967d8fc09a5b7e515bb5005726d677a08c86b (patch)
treedff76dd5f6f71af64ca3b7cc2e723fdd2dafc5a7 /src/main
parent65b5504e68e36116234bd69126304d6d764b678b (diff)
introduced build-time paranoia mode that disables unencrypted chats and forces TOR
Diffstat (limited to '')
-rw-r--r--src/main/java/eu/siacs/conversations/Config.java2
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Conversation.java11
-rw-r--r--src/main/java/eu/siacs/conversations/services/XmppConnectionService.java2
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ConversationActivity.java1
-rw-r--r--src/main/java/eu/siacs/conversations/ui/SettingsActivity.java12
-rw-r--r--src/main/res/xml/preferences.xml4
6 files changed, 27 insertions, 5 deletions
diff --git a/src/main/java/eu/siacs/conversations/Config.java b/src/main/java/eu/siacs/conversations/Config.java
index a5307468..0d51b4a1 100644
--- a/src/main/java/eu/siacs/conversations/Config.java
+++ b/src/main/java/eu/siacs/conversations/Config.java
@@ -17,7 +17,7 @@ public final class Config {
public static final boolean DISALLOW_REGISTRATION_IN_UI = false; //hide the register checkbox
public static final boolean HIDE_PGP_IN_UI = false; //some more consumer focused clients might want to disable OpenPGP
public static final boolean PARANOID_MODE = false; //disables ability to send unencrypted 1-on-1 chats and forces TOR
- public static final boolean SHOW_CONNECTED_ACCOUNTS = true; //show number of connected accounts in foreground notification
+ public static final boolean SHOW_CONNECTED_ACCOUNTS = false; //show number of connected accounts in foreground notification
public static final boolean LEGACY_NAMESPACE_HTTP_UPLOAD = false;
diff --git a/src/main/java/eu/siacs/conversations/entities/Conversation.java b/src/main/java/eu/siacs/conversations/entities/Conversation.java
index 473ef0fe..e93d5564 100644
--- a/src/main/java/eu/siacs/conversations/entities/Conversation.java
+++ b/src/main/java/eu/siacs/conversations/entities/Conversation.java
@@ -612,9 +612,16 @@ public class Conversation extends AbstractEntity implements Blockable {
if (next == -1) {
int outgoing = this.getMostRecentlyUsedOutgoingEncryption();
if (outgoing == Message.ENCRYPTION_NONE) {
- return this.getMostRecentlyUsedIncomingEncryption();
+ next = this.getMostRecentlyUsedIncomingEncryption();
} else {
- return outgoing;
+ next = outgoing;
+ }
+ }
+ if (Config.PARANOID_MODE && mode == MODE_SINGLE && next <= 0) {
+ if (getAccount().getAxolotlService().isContactAxolotlCapable(getContact())) {
+ return Message.ENCRYPTION_AXOLOTL;
+ } else {
+ return Message.ENCRYPTION_OTR;
}
}
return next;
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
index 30f8c687..fff8a984 100644
--- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
@@ -2550,7 +2550,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
}
public boolean useTorToConnect() {
- return getPreferences().getBoolean("use_tor", false);
+ return Config.PARANOID_MODE || getPreferences().getBoolean("use_tor", false);
}
public int unreadCount() {
diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
index 5ac2b1b4..1f6e57a0 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
@@ -815,6 +815,7 @@ public class ConversationActivity extends XmppActivity
MenuItem pgp = popup.getMenu().findItem(R.id.encryption_choice_pgp);
MenuItem axolotl = popup.getMenu().findItem(R.id.encryption_choice_axolotl);
pgp.setVisible(!Config.HIDE_PGP_IN_UI);
+ none.setVisible(!Config.PARANOID_MODE);
if (conversation.getMode() == Conversation.MODE_MULTI) {
otr.setVisible(false);
axolotl.setVisible(false);
diff --git a/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java b/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java
index 7118eb5a..da9738ab 100644
--- a/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java
@@ -9,7 +9,10 @@ import android.os.Build;
import android.os.Bundle;
import android.preference.ListPreference;
import android.preference.Preference;
+import android.preference.PreferenceCategory;
import android.preference.PreferenceManager;
+import android.preference.PreferenceScreen;
+import android.util.Log;
import android.widget.Toast;
import java.security.KeyStoreException;
@@ -19,6 +22,7 @@ import java.util.Collections;
import java.util.Locale;
import de.duenndns.ssl.MemorizingTrustManager;
+import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.xmpp.XmppConnection;
@@ -57,6 +61,14 @@ public class SettingsActivity extends XmppActivity implements
}
}
+ if (Config.PARANOID_MODE) {
+ PreferenceCategory connectionOptions = (PreferenceCategory) mSettingsFragment.findPreference("connection_options");
+ PreferenceScreen expert = (PreferenceScreen) mSettingsFragment.findPreference("expert");
+ if (connectionOptions != null) {
+ expert.removePreference(connectionOptions);
+ }
+ }
+
final Preference removeCertsPreference = mSettingsFragment.findPreference("remove_trusted_certificates");
removeCertsPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
diff --git a/src/main/res/xml/preferences.xml b/src/main/res/xml/preferences.xml
index 6ef3c029..16dc5eb9 100644
--- a/src/main/res/xml/preferences.xml
+++ b/src/main/res/xml/preferences.xml
@@ -147,7 +147,9 @@
android:summary="@string/pref_remove_trusted_certificates_summary"
android:title="@string/pref_remove_trusted_certificates_title"/>
</PreferenceCategory>
- <PreferenceCategory android:title="@string/pref_connection_options">
+ <PreferenceCategory
+ android:title="@string/pref_connection_options"
+ android:key="connection_options">
<CheckBoxPreference
android:defaultValue="false"
android:key="use_tor"