| author | Stephen Paul Weber
<singpolyma@singpolyma.net> 2024-07-03 02:31:11 UTC |
| committer | Stephen Paul Weber
<singpolyma@singpolyma.net> 2024-07-03 02:31:11 UTC |
| parent | 9d5716bead94334ba2fe4e6f6987e5da0cbab893 |
| snikket/Client.hx | +20 | -0 |
diff --git a/snikket/Client.hx b/snikket/Client.hx index 86bf715..2c829cb 100644 --- a/snikket/Client.hx +++ b/snikket/Client.hx @@ -119,6 +119,15 @@ class Client extends EventEmitter { final stanza:Stanza = event.stanza; final from = stanza.attr.get("from") == null ? null : JID.parse(stanza.attr.get("from")); + var fwd = null; + if (from != null && from.asBare().asString() == accountId()) { + var carbon = stanza.getChild("received", "urn:xmpp:carbons:2"); + if (carbon == null) carbon = stanza.getChild("sent", "urn:xmpp:carbons:2"); + if (carbon != null) { + fwd = carbon.getChild("forwarded", "urn:xmpp:forward:0")?.getFirstChild(); + } + } + final jmiP = stanza.getChild("propose", "urn:xmpp:jingle-message:0"); if (jmiP != null && jmiP.attr.get("id") != null) { final session = new IncomingProposedSession(this, from, jmiP.attr.get("id")); @@ -140,6 +149,17 @@ class Client extends EventEmitter { } } + // Another resource picked this up + final jmiProFwd = fwd?.getChild("proceed", "urn:xmpp:jingle-message:0"); + if (jmiProFwd != null && jmiProFwd.attr.get("id") != null) { + final chat = getDirectChat(JID.parse(fwd.attr.get("to")).asBare().asString()); + final session = chat.jingleSessions.get(jmiProFwd.attr.get("id")); + if (session != null) { + session.retract(); + chat.jingleSessions.remove(session.sid); + } + } + final jmiPro = stanza.getChild("proceed", "urn:xmpp:jingle-message:0"); if (jmiPro != null && jmiPro.attr.get("id") != null) { final chat = getDirectChat(from.asBare().asString());