From f6b22dad2032453bd2e1157488b142af1a86d413 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Mon, 14 Dec 2015 10:54:55 +0100 Subject: [PATCH] splite PARANOIA_MODE into three different options --- src/main/java/eu/siacs/conversations/Config.java | 4 +++- .../java/eu/siacs/conversations/entities/Conversation.java | 2 +- .../eu/siacs/conversations/services/NotificationService.java | 4 ++-- .../siacs/conversations/services/XmppConnectionService.java | 2 +- .../java/eu/siacs/conversations/ui/ConversationActivity.java | 2 +- .../java/eu/siacs/conversations/ui/EditAccountActivity.java | 2 +- src/main/java/eu/siacs/conversations/ui/SettingsActivity.java | 2 +- 7 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/Config.java b/src/main/java/eu/siacs/conversations/Config.java index 0b336ed39..1bb8028af 100644 --- a/src/main/java/eu/siacs/conversations/Config.java +++ b/src/main/java/eu/siacs/conversations/Config.java @@ -12,7 +12,9 @@ public final class Config { public static final String DOMAIN_LOCK = null; //only allow account creation for this domain 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 FORCE_ENCRYPTION = true; //disables ability to send unencrypted 1-on-1 + public static final boolean FORCE_ORBOT = false; // always use TOR + public static final boolean HIDE_MESSAGE_TEXT_IN_NOTIFICATION = false; 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 8b7aa8949..a085f0c03 100644 --- a/src/main/java/eu/siacs/conversations/entities/Conversation.java +++ b/src/main/java/eu/siacs/conversations/entities/Conversation.java @@ -616,7 +616,7 @@ public class Conversation extends AbstractEntity implements Blockable { next = outgoing; } } - if (Config.PARANOID_MODE && mode == MODE_SINGLE && next <= 0) { + if (Config.FORCE_ENCRYPTION && mode == MODE_SINGLE && next <= 0) { if (getAccount().getAxolotlService().isContactAxolotlCapable(getContact())) { return Message.ENCRYPTION_AXOLOTL; } else { diff --git a/src/main/java/eu/siacs/conversations/services/NotificationService.java b/src/main/java/eu/siacs/conversations/services/NotificationService.java index e8dec8154..624c0a604 100644 --- a/src/main/java/eu/siacs/conversations/services/NotificationService.java +++ b/src/main/java/eu/siacs/conversations/services/NotificationService.java @@ -234,7 +234,7 @@ public class NotificationService { if (messages.size() > 0) { conversation = messages.get(0).getConversation(); final String name = conversation.getName(); - if (Config.PARANOID_MODE) { + if (Config.HIDE_MESSAGE_TEXT_IN_NOTIFICATION) { int count = messages.size(); style.addLine(Html.fromHtml(""+name+" "+mXmppConnectionService.getResources().getQuantityString(R.plurals.x_messages,count,count))); } else { @@ -269,7 +269,7 @@ public class NotificationService { mBuilder.setLargeIcon(mXmppConnectionService.getAvatarService() .get(conversation, getPixel(64))); mBuilder.setContentTitle(conversation.getName()); - if (Config.PARANOID_MODE) { + if (Config.HIDE_MESSAGE_TEXT_IN_NOTIFICATION) { int count = messages.size(); mBuilder.setContentText(mXmppConnectionService.getResources().getQuantityString(R.plurals.x_messages,count,count)); } else { diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 9ecdf6ae8..0addbfd43 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -2568,7 +2568,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa } public boolean useTorToConnect() { - return Config.PARANOID_MODE || getPreferences().getBoolean("use_tor", false); + return Config.FORCE_ORBOT || 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 7129da438..688ee95cc 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java @@ -869,7 +869,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); + none.setVisible(!Config.FORCE_ENCRYPTION); if (conversation.getMode() == Conversation.MODE_MULTI) { otr.setVisible(false); axolotl.setVisible(false); diff --git a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java index fc8b36fea..a6c459968 100644 --- a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java @@ -491,7 +491,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate } } } - this.mUseTor = Config.PARANOID_MODE || getPreferences().getBoolean("use_tor", false); + this.mUseTor = Config.FORCE_ORBOT || getPreferences().getBoolean("use_tor", false); this.mNamePort.setVisibility(mUseTor ? View.VISIBLE : View.GONE); } diff --git a/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java b/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java index da9738ab5..aa23e36db 100644 --- a/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java @@ -61,7 +61,7 @@ public class SettingsActivity extends XmppActivity implements } } - if (Config.PARANOID_MODE) { + if (Config.FORCE_ORBOT) { PreferenceCategory connectionOptions = (PreferenceCategory) mSettingsFragment.findPreference("connection_options"); PreferenceScreen expert = (PreferenceScreen) mSettingsFragment.findPreference("expert"); if (connectionOptions != null) {