mirror of
https://github.com/moparisthebest/Conversations
synced 2024-12-11 01:52:17 -05:00
add origin-id to outgoing messages
This commit is contained in:
parent
9d043076e8
commit
1f3be1597c
@ -18,6 +18,7 @@ import eu.siacs.conversations.entities.Conversation;
|
|||||||
import eu.siacs.conversations.entities.Message;
|
import eu.siacs.conversations.entities.Message;
|
||||||
import eu.siacs.conversations.services.XmppConnectionService;
|
import eu.siacs.conversations.services.XmppConnectionService;
|
||||||
import eu.siacs.conversations.xml.Element;
|
import eu.siacs.conversations.xml.Element;
|
||||||
|
import eu.siacs.conversations.xml.Namespace;
|
||||||
import eu.siacs.conversations.xmpp.chatstate.ChatState;
|
import eu.siacs.conversations.xmpp.chatstate.ChatState;
|
||||||
import eu.siacs.conversations.xmpp.jid.Jid;
|
import eu.siacs.conversations.xmpp.jid.Jid;
|
||||||
import eu.siacs.conversations.xmpp.stanzas.MessagePacket;
|
import eu.siacs.conversations.xmpp.stanzas.MessagePacket;
|
||||||
@ -54,6 +55,7 @@ public class MessageGenerator extends AbstractGenerator {
|
|||||||
}
|
}
|
||||||
packet.setFrom(account.getJid());
|
packet.setFrom(account.getJid());
|
||||||
packet.setId(message.getUuid());
|
packet.setId(message.getUuid());
|
||||||
|
packet.addChild("origin-id", Namespace.STANZA_IDS).setAttribute("id",message.getUuid());
|
||||||
if (message.edited()) {
|
if (message.edited()) {
|
||||||
packet.addChild("replace","urn:xmpp:message-correct:0").setAttribute("id",message.getEditedId());
|
packet.addChild("replace","urn:xmpp:message-correct:0").setAttribute("id",message.getEditedId());
|
||||||
}
|
}
|
||||||
|
@ -366,7 +366,13 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
|
|||||||
final Jid counterpart;
|
final Jid counterpart;
|
||||||
final Jid to = packet.getTo();
|
final Jid to = packet.getTo();
|
||||||
final Jid from = packet.getFrom();
|
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;
|
boolean notify = false;
|
||||||
|
|
||||||
if (from == null) {
|
if (from == null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user