MAM: assume true counterpart is safe to extract when using mam:2

This commit is contained in:
Daniel Gultsch 2017-12-02 18:11:03 +01:00
parent 61f3539839
commit fc8a5641db
3 changed files with 6 additions and 4 deletions

View File

@ -100,8 +100,6 @@ public final class Config {
public static final boolean IGNORE_ID_REWRITE_IN_MUC = true; public static final boolean IGNORE_ID_REWRITE_IN_MUC = true;
public static final boolean PARSE_REAL_JID_FROM_MUC_MAM = false; //dangerous if server doesnt filter
public static final long MAM_MAX_CATCHUP = MILLISECONDS_IN_DAY * 5; public static final long MAM_MAX_CATCHUP = MILLISECONDS_IN_DAY * 5;
public static final int MAM_MAX_MESSAGES = 750; public static final int MAM_MAX_MESSAGES = 750;

View File

@ -506,8 +506,8 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
Jid trueCounterpart; Jid trueCounterpart;
if (message.getEncryption() == Message.ENCRYPTION_AXOLOTL) { if (message.getEncryption() == Message.ENCRYPTION_AXOLOTL) {
trueCounterpart = message.getTrueCounterpart(); trueCounterpart = message.getTrueCounterpart();
} else if (Config.PARSE_REAL_JID_FROM_MUC_MAM) { } else if (query != null && query.safeToExtractTrueCounterpart()) {
trueCounterpart = getTrueCounterpart(query != null ? mucUserElement : null, fallback); trueCounterpart = getTrueCounterpart(mucUserElement, fallback);
} else { } else {
trueCounterpart = fallback; trueCounterpart = fallback;
} }

View File

@ -354,6 +354,10 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded {
} }
} }
public boolean safeToExtractTrueCounterpart() {
return muc() && !isLegacy();
}
public Query next(String reference) { public Query next(String reference) {
Query query = page(reference); Query query = page(reference);
query.pagingOrder = PagingOrder.NORMAL; query.pagingOrder = PagingOrder.NORMAL;