git » sdk » commit 3e0a0a8

Store and send thread ids

author Stephen Paul Weber
2023-11-15 17:46:47 UTC
committer Stephen Paul Weber
2023-11-15 17:48:29 UTC
parent d6ac143eafaf4446b1e035b82bd3ffba7fa17e87

Store and send thread ids

xmpp/ChatMessage.hx +2 -0

diff --git a/xmpp/ChatMessage.hx b/xmpp/ChatMessage.hx
index d67f587..3764c58 100644
--- a/xmpp/ChatMessage.hx
+++ b/xmpp/ChatMessage.hx
@@ -60,6 +60,7 @@ class ChatMessage {
 		var msg = new ChatMessage();
 		msg.status = MessageDeliveredToDevice; // Delivered to us, a device
 		msg.timestamp = stanza.findText("{urn:xmpp:delay}delay@stamp") ?? Date.format(std.Date.now());
+		msg.threadId = stanza.getChildText("thread");
 		msg.lang = stanza.attr.get("xml:lang");
 		msg.text = stanza.getChildText("body");
 		if (msg.text != null && (msg.lang == null || msg.lang == "")) {
@@ -221,6 +222,7 @@ class ChatMessage {
 		if (to != null) attrs.set("to", to.asString());
 		if (localId != null) attrs.set("id", localId);
 		var stanza = new Stanza("message", attrs);
+		if (threadId != null) stanza.textTag("thread", threadId);
 		if (recipients.length > 1) {
 			final addresses = stanza.tag("addresses", { xmlns: "http://jabber.org/protocol/address" });
 			for (recipient in recipients) {