diff options
author | mightymop <totzkotz@gmail.com> | 2022-02-27 13:57:14 +0300 |
---|---|---|
committer | mightymop <totzkotz@gmail.com> | 2022-02-27 13:57:14 +0300 |
commit | 099f0d0926362c9b87d1e19a0ef37a0140a99028 (patch) | |
tree | ec777f57f051c8453a54ae641aaed00c8f5639f5 | |
parent | d3e8fa5ea0dc9827aa0868c79483de1246a309db (diff) |
fix: jingle, do not ring on carbonsfix_jingle
-rw-r--r-- | src/plugins/JingleMessageInitiationPlugin.ts | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/plugins/JingleMessageInitiationPlugin.ts b/src/plugins/JingleMessageInitiationPlugin.ts index dfaf5e39..afbee144 100644 --- a/src/plugins/JingleMessageInitiationPlugin.ts +++ b/src/plugins/JingleMessageInitiationPlugin.ts @@ -8,7 +8,7 @@ import JID from '@src/JID'; import { Call } from '@src/Call'; import { CallState, CallType } from '@src/CallManager'; import { IJID } from '@src/JID.interface'; - +import * as NS from '../connection/xmpp/namespace'; /** * XEP-0353: Jingle Message Initiation * @@ -121,6 +121,23 @@ export default class JingleMessageInitiationPlugin extends AbstractPlugin { const fromJid = new JID(fromAttribute); const sessionId = element.attr('id'); const contact = this.pluginAPI.getContact(fromJid); + const toAttribute = stanzaElement.attr('to'); + const toJid = new JID(toAttribute); + if (toJid.bare === fromJid.bare) { + let forwardedStanza = $(stanza).find('forwarded' + NS.getFilter('FORWARD')); + let carbonStanza = $(stanza).find('> ' + NS.getFilter('CARBONS')); + + if (forwardedStanza.length > 0 && carbonStanza.length > 0) { + if (carbonStanza.get(0) !== forwardedStanza.parent().get(0)) { + return true; + } + + let carbonTagName = <string>carbonStanza.prop('tagName') || ''; + if (carbonTagName.toLowerCase() === 'sent') { + return true; //dont accept message here, cause we dont want to ring on carbons sent out to others + } + } + } if (!contact || !sessionId) { return true; |