| author | Stephen Paul Weber
<singpolyma@singpolyma.net> 2025-06-24 17:51:32 UTC |
| committer | Stephen Paul Weber
<singpolyma@singpolyma.net> 2025-06-24 17:55:06 UTC |
| parent | fd3cd0106be8bdd2a40a0cc48bb5dd62f490d647 |
| snikket/Chat.hx | +1 | -1 |
| snikket/ChatMessage.hx | +1 | -1 |
diff --git a/snikket/Chat.hx b/snikket/Chat.hx index 68e4886..09b8b2a 100644 --- a/snikket/Chat.hx +++ b/snikket/Chat.hx @@ -1349,7 +1349,7 @@ class Channel extends Chat { message.versions = [message.build()]; // This is a correction message.localId = localId; client.storeMessages([message.build()], (corrected) -> { - message.versions = corrected[0].localId == localId ? cast corrected[0].versions : [message.build()]; + message.versions = corrected[0].versions[0]?.localId == localId ? cast corrected[0].versions : [message.build()]; message.localId = toSendId; client.sendStanza(message.build().asStanza()); client.notifyMessageHandlers(corrected[0], CorrectionEvent); diff --git a/snikket/ChatMessage.hx b/snikket/ChatMessage.hx index 8ef52ee..38d6d4a 100644 --- a/snikket/ChatMessage.hx +++ b/snikket/ChatMessage.hx @@ -418,7 +418,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 (versions.length > 0 && versions[versions.length-1].localId != null) stanza.tag("replace", { xmlns: "urn:xmpp:message-correct:0", id: versions[versions.length-1].localId }).up(); + if (versions.length > 0 && versions[0].localId != null) stanza.tag("replace", { xmlns: "urn:xmpp:message-correct:0", id: versions[0].localId }).up(); if (threadId != null) stanza.textTag("thread", threadId); if (recipients.length > 1) { final addresses = stanza.tag("addresses", { xmlns: "http://jabber.org/protocol/address" });