aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2016-06-12 12:50:49 +0200
committerDaniel Gultsch <daniel@gultsch.de>2016-06-12 12:50:53 +0200
commit31dd7b5a21d826756970cebb5b870b5aa55e0d24 (patch)
treed407d625ab3583740172c715a564988bf6e27549 /src
parent74d376be6850e2c78fe53c988d550c29bf41329a (diff)
parse real jid from muc mam messages. (disabled)
parsing this is dangerous if server doesn't filter properly thus it is disabled in config
Diffstat (limited to '')
-rw-r--r--src/main/java/eu/siacs/conversations/Config.java2
-rw-r--r--src/main/java/eu/siacs/conversations/parser/MessageParser.java16
2 files changed, 17 insertions, 1 deletions
diff --git a/src/main/java/eu/siacs/conversations/Config.java b/src/main/java/eu/siacs/conversations/Config.java
index 9e53e72b..516ff50f 100644
--- a/src/main/java/eu/siacs/conversations/Config.java
+++ b/src/main/java/eu/siacs/conversations/Config.java
@@ -96,6 +96,8 @@ 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 MILLISECONDS_IN_DAY = 24 * 60 * 60 * 1000;
public static final long MAM_MAX_CATCHUP = MILLISECONDS_IN_DAY / 2;
public static final int MAM_MAX_MESSAGES = 500;
diff --git a/src/main/java/eu/siacs/conversations/parser/MessageParser.java b/src/main/java/eu/siacs/conversations/parser/MessageParser.java
index 354128f0..2883b9a5 100644
--- a/src/main/java/eu/siacs/conversations/parser/MessageParser.java
+++ b/src/main/java/eu/siacs/conversations/parser/MessageParser.java
@@ -434,7 +434,21 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
message.setOob(isOob);
message.markable = packet.hasChild("markable", "urn:xmpp:chat-markers:0");
if (conversationMultiMode) {
- Jid trueCounterpart = conversation.getMucOptions().getTrueCounterpart(counterpart);
+ final Element item = mucUserElement == null ? null : mucUserElement.findChild("item");
+ Jid trueCounterpart;
+ if (Config.PARSE_REAL_JID_FROM_MUC_MAM && query != null && item != null) {
+ trueCounterpart = item.getAttributeAsJid("jid");
+ if (trueCounterpart != null) {
+ if (trueCounterpart.toBareJid().equals(account.getJid().toBareJid())) {
+ status = isTypeGroupChat ? Message.STATUS_SEND_RECEIVED : Message.STATUS_SEND;
+ } else {
+ status = Message.STATUS_RECEIVED;
+ }
+ message.setStatus(status);
+ }
+ } else {
+ trueCounterpart = conversation.getMucOptions().getTrueCounterpart(counterpart);
+ }
message.setTrueCounterpart(trueCounterpart);
if (!isTypeGroupChat) {
message.setType(Message.TYPE_PRIVATE);