splite PARANOIA_MODE into three different options

This commit is contained in:
Daniel Gultsch 2015-12-14 10:54:55 +01:00
parent 042939e44d
commit f6b22dad20
7 changed files with 10 additions and 8 deletions

View File

@ -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 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 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 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 SHOW_CONNECTED_ACCOUNTS = false; //show number of connected accounts in foreground notification
public static final boolean LEGACY_NAMESPACE_HTTP_UPLOAD = false; public static final boolean LEGACY_NAMESPACE_HTTP_UPLOAD = false;

View File

@ -616,7 +616,7 @@ public class Conversation extends AbstractEntity implements Blockable {
next = outgoing; 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())) { if (getAccount().getAxolotlService().isContactAxolotlCapable(getContact())) {
return Message.ENCRYPTION_AXOLOTL; return Message.ENCRYPTION_AXOLOTL;
} else { } else {

View File

@ -234,7 +234,7 @@ public class NotificationService {
if (messages.size() > 0) { if (messages.size() > 0) {
conversation = messages.get(0).getConversation(); conversation = messages.get(0).getConversation();
final String name = conversation.getName(); final String name = conversation.getName();
if (Config.PARANOID_MODE) { if (Config.HIDE_MESSAGE_TEXT_IN_NOTIFICATION) {
int count = messages.size(); int count = messages.size();
style.addLine(Html.fromHtml("<b>"+name+"</b> "+mXmppConnectionService.getResources().getQuantityString(R.plurals.x_messages,count,count))); style.addLine(Html.fromHtml("<b>"+name+"</b> "+mXmppConnectionService.getResources().getQuantityString(R.plurals.x_messages,count,count)));
} else { } else {
@ -269,7 +269,7 @@ public class NotificationService {
mBuilder.setLargeIcon(mXmppConnectionService.getAvatarService() mBuilder.setLargeIcon(mXmppConnectionService.getAvatarService()
.get(conversation, getPixel(64))); .get(conversation, getPixel(64)));
mBuilder.setContentTitle(conversation.getName()); mBuilder.setContentTitle(conversation.getName());
if (Config.PARANOID_MODE) { if (Config.HIDE_MESSAGE_TEXT_IN_NOTIFICATION) {
int count = messages.size(); int count = messages.size();
mBuilder.setContentText(mXmppConnectionService.getResources().getQuantityString(R.plurals.x_messages,count,count)); mBuilder.setContentText(mXmppConnectionService.getResources().getQuantityString(R.plurals.x_messages,count,count));
} else { } else {

View File

@ -2568,7 +2568,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
} }
public boolean useTorToConnect() { public boolean useTorToConnect() {
return Config.PARANOID_MODE || getPreferences().getBoolean("use_tor", false); return Config.FORCE_ORBOT || getPreferences().getBoolean("use_tor", false);
} }
public int unreadCount() { public int unreadCount() {

View File

@ -869,7 +869,7 @@ public class ConversationActivity extends XmppActivity
MenuItem pgp = popup.getMenu().findItem(R.id.encryption_choice_pgp); MenuItem pgp = popup.getMenu().findItem(R.id.encryption_choice_pgp);
MenuItem axolotl = popup.getMenu().findItem(R.id.encryption_choice_axolotl); MenuItem axolotl = popup.getMenu().findItem(R.id.encryption_choice_axolotl);
pgp.setVisible(!Config.HIDE_PGP_IN_UI); pgp.setVisible(!Config.HIDE_PGP_IN_UI);
none.setVisible(!Config.PARANOID_MODE); none.setVisible(!Config.FORCE_ENCRYPTION);
if (conversation.getMode() == Conversation.MODE_MULTI) { if (conversation.getMode() == Conversation.MODE_MULTI) {
otr.setVisible(false); otr.setVisible(false);
axolotl.setVisible(false); axolotl.setVisible(false);

View File

@ -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); this.mNamePort.setVisibility(mUseTor ? View.VISIBLE : View.GONE);
} }

View File

@ -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"); PreferenceCategory connectionOptions = (PreferenceCategory) mSettingsFragment.findPreference("connection_options");
PreferenceScreen expert = (PreferenceScreen) mSettingsFragment.findPreference("expert"); PreferenceScreen expert = (PreferenceScreen) mSettingsFragment.findPreference("expert");
if (connectionOptions != null) { if (connectionOptions != null) {