added setting to opt-out of message correction. renamed preferences and options to settings

This commit is contained in:
Daniel Gultsch 2016-02-16 09:57:59 +01:00
parent 0ca4a33bfb
commit a9b957e8a2
6 changed files with 36 additions and 19 deletions

View file

@ -31,7 +31,6 @@ public abstract class AbstractGenerator {
"urn:xmpp:avatar:metadata+notify",
"http://jabber.org/protocol/nick+notify",
"urn:xmpp:ping",
"urn:xmpp:message-correct:0",
"jabber:iq:version",
"http://jabber.org/protocol/chatstates",
AxolotlService.PEP_DEVICE_LIST+"+notify"};
@ -39,6 +38,9 @@ public abstract class AbstractGenerator {
"urn:xmpp:chat-markers:0",
"urn:xmpp:receipts"
};
private final String[] MESSAGE_CORRECTION_FEATURES = {
"urn:xmpp:message-correct:0"
};
private String mVersion = null;
protected final String IDENTITY_NAME = "Conversations";
protected final String IDENTITY_TYPE = "phone";
@ -90,6 +92,9 @@ public abstract class AbstractGenerator {
if (mXmppConnectionService.confirmMessages()) {
features.addAll(Arrays.asList(MESSAGE_CONFIRMATION_FEATURES));
}
if (mXmppConnectionService.allowMessageCorrection()) {
features.addAll(Arrays.asList(MESSAGE_CORRECTION_FEATURES));
}
Collections.sort(features);
return features;
}

View file

@ -393,7 +393,7 @@ public class MessageParser extends AbstractParser implements
updateLastseen(timestamp, account, packet.getFrom(), true);
}
if (replacementId != null) {
if (replacementId != null && mXmppConnectionService.allowMessageCorrection()) {
Message replacedMessage = conversation.findMessageWithRemoteIdAndCounterpart(replacementId, counterpart);
if (replacedMessage != null) {
final boolean fingerprintsMatch = replacedMessage.getAxolotlFingerprint() == null

View file

@ -2615,6 +2615,10 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
return getPreferences().getBoolean("confirm_messages", true);
}
public boolean allowMessageCorrection() {
return getPreferences().getBoolean("allow_message_correction", true);
}
public boolean sendChatStates() {
return getPreferences().getBoolean("chat_states", false);
}

View file

@ -162,7 +162,8 @@ public class SettingsActivity extends XmppActivity implements
xmppConnectionService.toggleForegroundService();
} else if (name.equals("confirm_messages")
|| name.equals("xa_on_silent_mode")
|| name.equals("away_when_screen_off")) {
|| name.equals("away_when_screen_off")
|| name.equals("allow_message_correction")) {
if (xmppConnectionServiceBound) {
if (name.equals("away_when_screen_off")) {
xmppConnectionService.toggleScreenEventReceiver();

View file

@ -104,7 +104,7 @@
<string name="pref_xmpp_resource_summary">The name this client identifies itself with</string>
<string name="pref_accept_files">Accept files</string>
<string name="pref_accept_files_summary">Automatically accept files smaller than…</string>
<string name="pref_notification_settings">Notification Settings</string>
<string name="pref_notification_settings">Notification</string>
<string name="pref_notifications">Notifications</string>
<string name="pref_notifications_summary">Notify when a new message arrives</string>
<string name="pref_vibrate">Vibrate</string>
@ -113,12 +113,12 @@
<string name="pref_sound_summary">Play ringtone with notification</string>
<string name="pref_notification_grace_period">Notification grace period</string>
<string name="pref_notification_grace_period_summary">Disable notifications for a short time after a carbon copy was received</string>
<string name="pref_advanced_options">Advanced Options</string>
<string name="pref_advanced_options">Advanced</string>
<string name="pref_never_send_crash">Never send crash reports</string>
<string name="pref_never_send_crash_summary">By sending in stack traces you are helping the ongoing development of Conversations</string>
<string name="pref_confirm_messages">Confirm Messages</string>
<string name="pref_confirm_messages_summary">Let your contact know when you have received and read a message</string>
<string name="pref_ui_options">UI Options</string>
<string name="pref_ui_options">UI</string>
<string name="openpgp_error">OpenKeychain reported an error</string>
<string name="error_decrypting_file">I/O Error decrypting file</string>
<string name="accept">Accept</string>
@ -278,12 +278,14 @@
<string name="sure_delete_fingerprint">Are you sure you would like to delete this fingerprint?</string>
<string name="ignore">Ignore</string>
<string name="without_mutual_presence_updates"><b>Warning:</b> Sending this without mutual presence updates could cause unexpected problems.\n\n<small>Go to contact details to verify your presence subscriptions.</small></string>
<string name="pref_encryption_settings">Encryption settings</string>
<string name="pref_security_settings">Security</string>
<string name="pref_force_encryption">Force end-to-end encryption</string>
<string name="pref_force_encryption_summary">Always send messages encrypted (except for conferences)</string>
<string name="pref_allow_message_correction">Allow message correction</string>
<string name="pref_allow_message_correction_summary">Allow your contacts to retroactively edit their messages</string>
<string name="pref_dont_save_encrypted">Dont save encrypted messages</string>
<string name="pref_dont_save_encrypted_summary">Warning: This could lead to message loss</string>
<string name="pref_expert_options">Expert options</string>
<string name="pref_expert_options">Expert settings</string>
<string name="pref_expert_options_summary">Please be careful with these</string>
<string name="title_activity_about">About Conversations</string>
<string name="pref_about_conversations_summary">Build and licensing information</string>
@ -464,7 +466,7 @@
<string name="two_hours">2 hours</string>
<string name="eight_hours">8 hours</string>
<string name="until_further_notice">Until further notice</string>
<string name="pref_input_options">Input options</string>
<string name="pref_input_options">Input</string>
<string name="pref_enter_is_send">Enter is send</string>
<string name="pref_enter_is_send_summary">Use enter key to send message</string>
<string name="pref_display_enter_key">Show enter key</string>
@ -528,20 +530,20 @@
<string name="pref_use_white_background_summary">Show received messages as black text on a white background</string>
<string name="account_status_tor_unavailable">Tor network unavailable</string>
<string name="server_info_broken">Broken</string>
<string name="pref_presence_settings">Presence settings</string>
<string name="pref_presence_settings">Presence</string>
<string name="pref_away_when_screen_off">Away when screen is off</string>
<string name="pref_away_when_screen_off_summary">Marks your resource as away when the screen is turned off</string>
<string name="pref_xa_on_silent_mode">Not available in silent mode</string>
<string name="pref_xa_on_silent_mode_summary">Marks your resource as not available when device is in silent mode</string>
<string name="pref_show_connection_options">Extended connection options</string>
<string name="pref_show_connection_options_summary">Show hostname and port options when setting up an account</string>
<string name="pref_show_connection_options">Extended connection settings</string>
<string name="pref_show_connection_options_summary">Show hostname and port settings when setting up an account</string>
<string name="hostname_example">xmpp.example.com</string>
<string name="action_add_account_with_certificate">Add account with certificate</string>
<string name="unable_to_parse_certificate">Unable to parse certificate</string>
<string name="authenticate_with_certificate">Leave empty to authenticate w/ certificate</string>
<string name="mam_prefs">Archiving preferences</string>
<string name="fetching_mam_prefs">Fetching archiving preferences. Please wait…</string>
<string name="unable_to_fetch_mam_prefs">Unable to fetch archiving preferences</string>
<string name="mam_prefs">Archiving settting</string>
<string name="fetching_mam_prefs">Fetching archiving settings. Please wait…</string>
<string name="unable_to_fetch_mam_prefs">Unable to fetch archiving setting</string>
<string name="captcha_ocr">Captcha text</string>
<string name="captcha_required">Captcha required</string>
<string name="captcha_hint">enter the text from the image</string>
@ -551,7 +553,7 @@
<string name="error_fetching_omemo_key">Error fetching OMEMO key!</string>
<string name="verified_omemo_key_with_certificate">Verified OMEMO key with certificate!</string>
<string name="device_does_not_support_certificates">Your device does not support the selection of client certificates!</string>
<string name="pref_connection_options">Connection options</string>
<string name="pref_connection_options">Connection</string>
<string name="pref_use_tor">Connect via Tor</string>
<string name="pref_use_tor_summary">Tunnel all connections through the Tor network. Requires Orbot</string>
<string name="account_settings_hostname">Hostname</string>
@ -575,7 +577,7 @@
<string name="certificate_issuer">Issuer</string>
<string name="certificate_cn">Common Name</string>
<string name="certificate_o">Organization</string>
<string name="certificate_sha1">SHA1</string>
<string name="certificate_sha1">SHA-1</string>
<string name="certicate_info_not_available">(Not available)</string>
<string name="certificate_not_found">No certificate found</string>
<string name="notify_on_all_messages">Notify on all messages</string>
@ -583,7 +585,7 @@
<string name="notify_never">Notifications disabled</string>
<string name="notify_paused">Notifications paused</string>
<string name="pref_picture_compression">Compress Pictures</string>
<string name="pref_picture_compression_summary">Resize and compressed pictures</string>
<string name="pref_picture_compression_summary">Resize and compress pictures</string>
<string name="always">Always</string>
<string name="automatically">Automatically</string>
<string name="battery_optimizations_enabled">Battery optimizations enabled</string>

View file

@ -131,7 +131,7 @@
android:key="expert"
android:summary="@string/pref_expert_options_summary"
android:title="@string/pref_expert_options">
<PreferenceCategory android:title="@string/pref_encryption_settings">
<PreferenceCategory android:title="@string/pref_security_settings">
<CheckBoxPreference
android:defaultValue="false"
android:key="dont_save_encrypted"
@ -146,6 +146,11 @@
android:key="remove_trusted_certificates"
android:summary="@string/pref_remove_trusted_certificates_summary"
android:title="@string/pref_remove_trusted_certificates_title"/>
<CheckBoxPreference
android:defaultValue="true"
android:key="allow_message_correction"
android:title="@string/pref_allow_message_correction"
android:summary="@string/pref_allow_message_correction_summary"/>
</PreferenceCategory>
<PreferenceCategory
android:key="connection_options"