How to use the @converse/headless/utils/core.isChatRoom 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
getMessageAttributesFromStanza (stanza, original_stanza, chatbox, _converse) {
        const is_muc = u.isChatRoom(chatbox);
        let attrs = Object.assign(
            stanza_utils.getStanzaIDs(stanza, original_stanza),
            stanza_utils.getRetractionAttributes(stanza, original_stanza),
            is_muc ? stanza_utils.getModerationAttributes(stanza, original_stanza, chatbox) : {},
        );
        const text = stanza_utils.getMessageBody(stanza, is_muc, _converse) || undefined;
        const delay = sizzle(`delay[xmlns="${Strophe.NS.DELAY}"]`, original_stanza).pop();
        attrs = Object.assign(
            {
                'chat_state': stanza_utils.getChatState(stanza),
                'is_archived': stanza_utils.isArchived(original_stanza),
                'is_delayed': !!delay,
                'is_only_emojis': text ? u.isOnlyEmojis(text) : false,
                'message': text,
                'msgid': stanza.getAttribute('id') || original_stanza.getAttribute('id'),
                'references': stanza_utils.getReferences(stanza),
github conversejs / converse.js / src / headless / utils / stanza.js View on Github external
getSenderAttributes (stanza, chatbox, _converse) {
        if (u.isChatRoom(chatbox)) {
            const from = stanza.getAttribute('from');
            const nick = Strophe.unescapeNode(Strophe.getResourceFromJid(from));
            return {
                'from':  from,
                'nick': nick,
                'sender': nick === chatbox.get('nick') ? 'me': 'them',
                'received': (new Date()).toISOString(),
            }
        } else {
            const from = Strophe.getBareJidFromJid(stanza.getAttribute('from'));
            if (from === _converse.bare_jid) {
                return {
                    from,
                    'sender': 'me',
                    'fullname': _converse.xmppstatus.get('fullname')
                }