Skip to content

Commit

Permalink
Do not process MAM messages in main message handle
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
singpolyma committed Nov 18, 2024
1 parent 71f1dea commit 7b6867e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions snikket/Client.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 7b6867e

Please sign in to comment.