diff options
author | Christian Schneppe <christian.schneppe@pix-art.de> | 2019-12-08 15:37:29 +0100 |
---|---|---|
committer | Christian Schneppe <christian.schneppe@pix-art.de> | 2019-12-08 15:37:29 +0100 |
commit | 32b1ab2b3b54c53e61c61bc779ae01bc9b62c776 (patch) | |
tree | b61f5bb9255f66b8ada06d87794cbf93f242c6d1 /src/main | |
parent | d6652c571d9167b6966543013297faf5640d03cf (diff) |
only show message deleted if LMC is activated
Diffstat (limited to 'src/main')
3 files changed, 9 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/parser/MessageParser.java b/src/main/java/de/pixart/messenger/parser/MessageParser.java index 020866fa1..8dadbd364 100644 --- a/src/main/java/de/pixart/messenger/parser/MessageParser.java +++ b/src/main/java/de/pixart/messenger/parser/MessageParser.java @@ -53,6 +53,8 @@ import de.pixart.messenger.xmpp.pep.Avatar; import de.pixart.messenger.xmpp.stanzas.MessagePacket; import rocks.xmpp.addr.Jid; +import static de.pixart.messenger.entities.Message.DELETED_MESSAGE_BODY; + public class MessageParser extends AbstractParser implements OnMessagePacketReceived { private static final List<String> CLIENTS_SENDING_HTML_IN_OTR = Arrays.asList("Pidgin", "Adium", "Trillian"); @@ -741,6 +743,9 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": received message correction but verification didn't check out"); } } + } else if (replacementId != null && !mXmppConnectionService.allowMessageCorrection() && message.getBody().equals(DELETED_MESSAGE_BODY)) { + Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": received deleted message but LMC is deactivated"); + return; } long deletionDate = mXmppConnectionService.getAutomaticMessageDeletionDate(); diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index 87b7b67ae..038e4f235 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -168,6 +168,7 @@ import de.pixart.messenger.xmpp.stanzas.PresencePacket; import me.leolin.shortcutbadger.ShortcutBadger; import rocks.xmpp.addr.Jid; +import static de.pixart.messenger.ui.SettingsActivity.ALLOW_MESSAGE_CORRECTION; import static de.pixart.messenger.ui.SettingsActivity.CHAT_STATES; import static de.pixart.messenger.ui.SettingsActivity.CONFIRM_MESSAGES; import static de.pixart.messenger.ui.SettingsActivity.ENABLE_MULTI_ACCOUNTS; @@ -4266,7 +4267,7 @@ public class XmppConnectionService extends Service { } public boolean allowMessageCorrection() { - return getBooleanPreference("allow_message_correction", R.bool.allow_message_correction); + return getBooleanPreference(ALLOW_MESSAGE_CORRECTION, R.bool.allow_message_correction); } public boolean sendChatStates() { diff --git a/src/main/java/de/pixart/messenger/ui/SettingsActivity.java b/src/main/java/de/pixart/messenger/ui/SettingsActivity.java index 24c782dfb..2ef7ead13 100644 --- a/src/main/java/de/pixart/messenger/ui/SettingsActivity.java +++ b/src/main/java/de/pixart/messenger/ui/SettingsActivity.java @@ -74,6 +74,7 @@ public class SettingsActivity extends XmppActivity implements public static final String CONFIRM_MESSAGES = "confirm_messages"; public static final String INDICATE_RECEIVED = "indicate_received"; public static final String USE_INVIDIOUS = "use_invidious"; + public static final String ALLOW_MESSAGE_CORRECTION = "allow_message_correction"; public static final int REQUEST_CREATE_BACKUP = 0xbf8701; Preference multiAccountPreference; @@ -482,7 +483,7 @@ public class SettingsActivity extends XmppActivity implements CONFIRM_MESSAGES, DND_ON_SILENT_MODE, AWAY_WHEN_SCREEN_IS_OFF, - "allow_message_correction", + ALLOW_MESSAGE_CORRECTION, TREAT_VIBRATE_AS_SILENT, MANUALLY_CHANGE_PRESENCE, BROADCAST_LAST_ACTIVITY); |