aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-12-10 20:55:28 +0100
committerChristian Schneppe <christian@pix-art.de>2017-12-10 20:55:28 +0100
commita67ae91d9fefd829408cc62e25514fa38c8762e6 (patch)
tree58c5e952f3a37685658d21003a0214cfc9f69af4 /src/main
parent8e8a1f04800fce4618506ff2c47157f94bd6c489 (diff)
MAM: assume true counterpart is safe to extract when using mam:2
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/de/pixart/messenger/Config.java2
-rw-r--r--src/main/java/de/pixart/messenger/parser/MessageParser.java4
-rw-r--r--src/main/java/de/pixart/messenger/services/MessageArchiveService.java4
3 files changed, 6 insertions, 4 deletions
diff --git a/src/main/java/de/pixart/messenger/Config.java b/src/main/java/de/pixart/messenger/Config.java
index 893245282..7715ed665 100644
--- a/src/main/java/de/pixart/messenger/Config.java
+++ b/src/main/java/de/pixart/messenger/Config.java
@@ -110,8 +110,6 @@ public final class Config {
public static final boolean IGNORE_ID_REWRITE_IN_MUC = true;
- public static final boolean PARSE_REAL_JID_FROM_MUC_MAM = false; //dangerous if server doesn’t filter
-
public static final long MAM_MAX_CATCHUP = MILLISECONDS_IN_DAY * 5;
public static final int MAM_MAX_MESSAGES = 750;
diff --git a/src/main/java/de/pixart/messenger/parser/MessageParser.java b/src/main/java/de/pixart/messenger/parser/MessageParser.java
index 9d64110a8..64bb0b2d5 100644
--- a/src/main/java/de/pixart/messenger/parser/MessageParser.java
+++ b/src/main/java/de/pixart/messenger/parser/MessageParser.java
@@ -502,8 +502,8 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
Jid trueCounterpart;
if (message.getEncryption() == Message.ENCRYPTION_AXOLOTL) {
trueCounterpart = message.getTrueCounterpart();
- } else if (Config.PARSE_REAL_JID_FROM_MUC_MAM) {
- trueCounterpart = getTrueCounterpart(query != null ? mucUserElement : null, fallback);
+ } else if (query != null && query.safeToExtractTrueCounterpart()) {
+ trueCounterpart = getTrueCounterpart(mucUserElement, fallback);
} else {
trueCounterpart = fallback;
}
diff --git a/src/main/java/de/pixart/messenger/services/MessageArchiveService.java b/src/main/java/de/pixart/messenger/services/MessageArchiveService.java
index b5ee9ac52..ab4be5eda 100644
--- a/src/main/java/de/pixart/messenger/services/MessageArchiveService.java
+++ b/src/main/java/de/pixart/messenger/services/MessageArchiveService.java
@@ -353,6 +353,10 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded {
}
}
+ public boolean safeToExtractTrueCounterpart() {
+ return muc() && !isLegacy();
+ }
+
public Query next(String reference) {
Query query = page(reference);
query.pagingOrder = PagingOrder.NORMAL;