aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2016-02-16 09:57:59 +0100
committerDaniel Gultsch <daniel@gultsch.de>2016-02-16 09:57:59 +0100
commita9b957e8a2b9cb7729ed0d2cc8b5efa1bee50c79 (patch)
treebaffe59d760a36e3b1f23fc1ff8230d658fa77b5
parent0ca4a33bfb76d63a3c2d4447643a5bd90ac5315f (diff)
added setting to opt-out of message correction. renamed preferences and options to settings
-rw-r--r--src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java7
-rw-r--r--src/main/java/eu/siacs/conversations/parser/MessageParser.java2
-rw-r--r--src/main/java/eu/siacs/conversations/services/XmppConnectionService.java4
-rw-r--r--src/main/java/eu/siacs/conversations/ui/SettingsActivity.java3
-rw-r--r--src/main/res/values/strings.xml32
-rw-r--r--src/main/res/xml/preferences.xml7
6 files changed, 36 insertions, 19 deletions
diff --git a/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java b/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java
index d223ab84..05fa0b82 100644
--- a/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java
+++ b/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java
@@ -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;
}
diff --git a/src/main/java/eu/siacs/conversations/parser/MessageParser.java b/src/main/java/eu/siacs/conversations/parser/MessageParser.java
index 18edfdeb..620039a1 100644
--- a/src/main/java/eu/siacs/conversations/parser/MessageParser.java
+++ b/src/main/java/eu/siacs/conversations/parser/MessageParser.java
@@ -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
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
index a8fe7586..0c8f0b8b 100644
--- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
@@ -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);
}
diff --git a/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java b/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java
index aa23e36d..07c328b9 100644
--- a/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java
@@ -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();
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index 15322e04..da29bfe6 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -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">Don’t 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>
diff --git a/src/main/res/xml/preferences.xml b/src/main/res/xml/preferences.xml
index 382b3199..e8747a8b 100644
--- a/src/main/res/xml/preferences.xml
+++ b/src/main/res/xml/preferences.xml
@@ -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"