diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-03-09 20:48:03 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-03-09 20:48:03 +0100 |
commit | 5d910a7c7375d2ab98e1488529fc111b055899cb (patch) | |
tree | b77264d4a1cc2db6791da784c6d707109126aadf | |
parent | 1d768321d95d5102d7b9ea8eac11565995363047 (diff) |
add origin-id to outgoing messages
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/pixart/messenger/generator/MessageGenerator.java | 2 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/parser/MessageParser.java | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/generator/MessageGenerator.java b/src/main/java/de/pixart/messenger/generator/MessageGenerator.java index b66fb4dc5..c336f41d5 100644 --- a/src/main/java/de/pixart/messenger/generator/MessageGenerator.java +++ b/src/main/java/de/pixart/messenger/generator/MessageGenerator.java @@ -17,6 +17,7 @@ import de.pixart.messenger.entities.Contact; import de.pixart.messenger.entities.Conversation; import de.pixart.messenger.entities.Message; import de.pixart.messenger.services.XmppConnectionService; +import de.pixart.messenger.utils.Namespace; import de.pixart.messenger.xml.Element; import de.pixart.messenger.xmpp.chatstate.ChatState; import de.pixart.messenger.xmpp.jid.Jid; @@ -54,6 +55,7 @@ public class MessageGenerator extends AbstractGenerator { } packet.setFrom(account.getJid()); packet.setId(message.getUuid()); + packet.addChild("origin-id", Namespace.STANZA_IDS).setAttribute("id", message.getUuid()); if (message.edited()) { packet.addChild("replace", "urn:xmpp:message-correct:0").setAttribute("id", message.getEditedId()); } diff --git a/src/main/java/de/pixart/messenger/parser/MessageParser.java b/src/main/java/de/pixart/messenger/parser/MessageParser.java index b34c382e4..2fa7160b6 100644 --- a/src/main/java/de/pixart/messenger/parser/MessageParser.java +++ b/src/main/java/de/pixart/messenger/parser/MessageParser.java @@ -365,7 +365,13 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece final Jid counterpart; final Jid to = packet.getTo(); final Jid from = packet.getFrom(); - final String remoteMsgId = packet.getId(); + final Element originId = packet.findChild("origin-id", Namespace.STANZA_IDS); + final String remoteMsgId; + if (originId != null && originId.getAttribute("id") != null) { + remoteMsgId = originId.getAttribute("id"); + } else { + remoteMsgId = packet.getId(); + } boolean notify = false; if (from == null) { |