diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2015-12-01 22:41:58 +0100 |
---|---|---|
committer | Christian S <christian@pix-art.de> | 2015-12-04 20:12:48 +0100 |
commit | e9c184fbce5e3bfaa25a0ecca6d1942014e4d977 (patch) | |
tree | e5d07bc512a6b86877cd276f10ffedefac31de48 /src/main/java/eu | |
parent | 0b6f5f29197fad79bb90be4d51c1b87c7577e4ff (diff) |
introduced build-time paranoia mode that disables unencrypted chats a…
…nd forces TOR
Diffstat (limited to '')
4 files changed, 23 insertions, 4 deletions
diff --git a/src/main/java/eu/siacs/conversations/Config.java b/src/main/java/eu/siacs/conversations/Config.java index ecec5cd1a..62ceffa53 100644 --- a/src/main/java/eu/siacs/conversations/Config.java +++ b/src/main/java/eu/siacs/conversations/Config.java @@ -20,7 +20,7 @@ public final class Config { public static final boolean HIDE_ENCRYPTION_IN_UI = false; //completely hide encryption options in menu bar 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; // true = 'eu:siacs:conversations:http:upload' false = 'urn:xmpp:http:upload' diff --git a/src/main/java/eu/siacs/conversations/entities/Conversation.java b/src/main/java/eu/siacs/conversations/entities/Conversation.java index ee1eb2110..271ddd621 100644 --- a/src/main/java/eu/siacs/conversations/entities/Conversation.java +++ b/src/main/java/eu/siacs/conversations/entities/Conversation.java @@ -626,9 +626,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 ac084758b..2bafb03aa 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -2567,7 +2567,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/SettingsActivity.java b/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java index 7118eb5a8..da9738ab5 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 |