How to use the @converse/headless/utils/core.getUniqueId function in @converse/headless

To help you get started, we’ve selected a few @converse/headless examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github conversejs / converse.js / src / headless / utils / stanza.js View on Github external
if (stanza_ids.length) {
            stanza_ids.forEach(s => (attrs[`stanza_id ${s.getAttribute('by')}`] = s.getAttribute('id')));
        }
        const result = sizzle(`message > result[xmlns="${Strophe.NS.MAM}"]`, original_stanza).pop();
        if (result) {
            const by_jid = original_stanza.getAttribute('from');
            attrs[`stanza_id ${by_jid}`] = result.getAttribute('id');
        }

        const origin_id = sizzle(`origin-id[xmlns="${Strophe.NS.SID}"]`, stanza).pop();
        if (origin_id) {
            attrs['origin_id'] = origin_id.getAttribute('id');
        }
        // We prefer to use one of the XEP-0359 unique and stable stanza IDs
        // as the Model id, to avoid duplicates.
        attrs['id'] = attrs['origin_id'] || attrs[`stanza_id ${attrs.from}`] || u.getUniqueId();
        return attrs;
    },