From 7b6867ebceb50a543781d56c0747439ab3482108 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Mon, 18 Nov 2024 17:04:35 -0500 Subject: [PATCH] Do not process MAM messages in main message handle Since all handlers get called for every stanza, even though the MessageSync object has its own handler, this event still fires, but we want to do as little work as possible and bail out since we know it's being handled elsewhere. --- snikket/Client.hx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/snikket/Client.hx b/snikket/Client.hx index 28870b3..840912b 100644 --- a/snikket/Client.hx +++ b/snikket/Client.hx @@ -135,6 +135,12 @@ class Client extends EventEmitter { stream.on("message", function(event) { final stanza:Stanza = event.stanza; + + if (stanza.getChild("result", "urn:xmpp:mam:2") != null) { + // We don't want to process MAM messages here + return EventUnhandled; + } + final from = stanza.attr.get("from") == null ? null : JID.parse(stanza.attr.get("from")); if (stanza.attr.get("type") == "error" && from != null) {