1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-23 18:02:15 -05:00

Issue 4690: Add privacy pref to omit K-9 User-Agent header.

This commit is contained in:
Mike Perry 2014-05-26 14:57:25 -07:00
parent 7ac7fe2cfe
commit 87802a01ef
6 changed files with 28 additions and 1 deletions

View File

@ -331,6 +331,7 @@ Please submit bug reports, contribute new features and ask questions at
<string name="global_settings_confirm_action_spam">Spam</string>
<string name="global_settings_confirm_action_delete_notif">Delete (from notification)</string>
<string name="global_settings_privacy_hide_useragent">Remove K-9 User-Agent from mail headers</string>
<string name="global_settings_notification_hide_subject_title">Hide subject in notifications</string>
<string name="global_settings_notification_hide_subject_never">Never</string>
<string name="global_settings_notification_hide_subject_when_locked">When device is locked</string>

View File

@ -378,6 +378,11 @@
android:entryValues="@array/global_settings_notification_hide_subject_values"
android:title="@string/global_settings_notification_hide_subject_title"/>
<CheckBoxPreference
android:persistent="false"
android:key="privacy_hide_useragent"
android:title="@string/global_settings_privacy_hide_useragent"/>
</PreferenceScreen>
<PreferenceScreen

View File

@ -262,6 +262,7 @@ public class K9 extends Application {
private static String mQuietTimeEnds = null;
private static String mAttachmentDefaultPath = "";
private static boolean mWrapFolderNames = false;
private static boolean mHideUserAgent = false;
private static boolean useGalleryBugWorkaround = false;
private static boolean galleryBuggy;
@ -535,6 +536,7 @@ public class K9 extends Application {
editor.putBoolean("messageViewReturnToList", mMessageViewReturnToList);
editor.putBoolean("messageViewShowNext", mMessageViewShowNext);
editor.putBoolean("wrapFolderNames", mWrapFolderNames);
editor.putBoolean("hideUserAgent", mHideUserAgent);
editor.putString("language", language);
editor.putInt("theme", theme.ordinal());
@ -745,6 +747,7 @@ public class K9 extends Application {
mMessageViewReturnToList = sprefs.getBoolean("messageViewReturnToList", false);
mMessageViewShowNext = sprefs.getBoolean("messageViewShowNext", false);
mWrapFolderNames = sprefs.getBoolean("wrapFolderNames", false);
mHideUserAgent = sprefs.getBoolean("hideUserAgent", false);
useGalleryBugWorkaround = sprefs.getBoolean("useGalleryBugWorkaround", K9.isGalleryBuggy());
@ -1274,6 +1277,13 @@ public class K9 extends Application {
mWrapFolderNames = state;
}
public static boolean hideUserAgent() {
return mHideUserAgent;
}
public static void setHideUserAgent(final boolean state) {
mHideUserAgent = state;
}
public static String getAttachmentDefaultPath() {
return mAttachmentDefaultPath;
}

View File

@ -1425,7 +1425,10 @@ public class MessageCompose extends K9Activity implements OnClickListener,
message.setHeader("X-Confirm-Reading-To", from.toEncodedString());
message.setHeader("Return-Receipt-To", from.toEncodedString());
}
if (!K9.hideUserAgent()) {
message.setHeader("User-Agent", getString(R.string.message_header_mua));
}
final String replyTo = mIdentity.getReplyTo();
if (replyTo != null) {

View File

@ -85,6 +85,7 @@ public class Prefs extends K9PreferenceActivity {
private static final String PREFERENCE_QUIET_TIME_STARTS = "quiet_time_starts";
private static final String PREFERENCE_QUIET_TIME_ENDS = "quiet_time_ends";
private static final String PREFERENCE_NOTIF_QUICK_DELETE = "notification_quick_delete";
private static final String PREFERENCE_HIDE_USERAGENT = "privacy_hide_useragent";
private static final String PREFERENCE_MESSAGEVIEW_MOBILE_LAYOUT = "messageview_mobile_layout";
private static final String PREFERENCE_AUTOFIT_WIDTH = "messageview_autofit_width";
@ -140,6 +141,7 @@ public class Prefs extends K9PreferenceActivity {
private CheckBoxPreference mUseGalleryBugWorkaround;
private CheckBoxPreference mDebugLogging;
private CheckBoxPreference mSensitiveLogging;
private CheckBoxPreference mHideUserAgent;
private CheckBoxPreference mWrapFolderNames;
private CheckBoxListPreference mVisibleRefileActions;
@ -382,9 +384,11 @@ public class Prefs extends K9PreferenceActivity {
mDebugLogging = (CheckBoxPreference)findPreference(PREFERENCE_DEBUG_LOGGING);
mSensitiveLogging = (CheckBoxPreference)findPreference(PREFERENCE_SENSITIVE_LOGGING);
mHideUserAgent = (CheckBoxPreference)findPreference(PREFERENCE_HIDE_USERAGENT);
mDebugLogging.setChecked(K9.DEBUG);
mSensitiveLogging.setChecked(K9.DEBUG_SENSITIVE);
mHideUserAgent.setChecked(K9.hideUserAgent());
mAttachmentPathPreference = findPreference(PREFERENCE_ATTACHMENT_DEF_PATH);
mAttachmentPathPreference.setSummary(K9.getAttachmentDefaultPath());
@ -532,6 +536,7 @@ public class Prefs extends K9PreferenceActivity {
}
K9.DEBUG = mDebugLogging.isChecked();
K9.DEBUG_SENSITIVE = mSensitiveLogging.isChecked();
K9.setHideUserAgent(mHideUserAgent.isChecked());
Editor editor = preferences.edit();
K9.save(editor);

View File

@ -249,6 +249,9 @@ public class GlobalSettings {
s.put("fontSizeMessageViewContentPercent", Settings.versions(
new V(31, new IntegerRangeSetting(40, 250, 100))
));
s.put("hideUserAgent", Settings.versions(
new V(32, new BooleanSetting(false))
));
SETTINGS = Collections.unmodifiableMap(s);