How to use the @converse/headless/log.debug 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 / converse-core.js View on Github external
this.onConnectStatusChanged = function (status, message) {
        log.debug(`Status changed to: ${_converse.CONNECTION_STATUS[status]}`);
        if (status === Strophe.Status.CONNECTED || status === Strophe.Status.ATTACHED) {
            _converse.setConnectionStatus(status);
            // By default we always want to send out an initial presence stanza.
            _converse.send_initial_presence = true;
            _converse.setDisconnectionCause();
            if (_converse.connection.reconnecting) {
                log.debug(status === Strophe.Status.CONNECTED ? 'Reconnected' : 'Reattached');
                onConnected(true);
            } else {
                log.debug(status === Strophe.Status.CONNECTED ? 'Connected' : 'Attached');
                if (_converse.connection.restored) {
                    // No need to send an initial presence stanza when
                    // we're restoring an existing session.
                    _converse.send_initial_presence = false;
                }
                onConnected();
            }
        } else if (status === Strophe.Status.DISCONNECTED) {
            _converse.setDisconnectionCause(status, message);
            _converse.onDisconnected();
        } else if (status === Strophe.Status.BINDREQUIRED) {
            _converse.bindResource();
        } else if (status === Strophe.Status.ERROR) {
github conversejs / converse.js / src / converse-register.js View on Github external
onConnectStatusChanged(status_code) {
                log.debug('converse-register: onConnectStatusChanged');
                if (_.includes([
                            Strophe.Status.DISCONNECTED,
                            Strophe.Status.CONNFAIL,
                            Strophe.Status.REGIFAIL,
                            Strophe.Status.NOTACCEPTABLE,
                            Strophe.Status.CONFLICT
                        ], status_code)) {

                    log.error(
                        `Problem during registration: Strophe.Status is ${_converse.CONNECTION_STATUS[status_code]}`
                    );
                    this.abortRegistration();
                } else if (status_code === Strophe.Status.REGISTERED) {
                    log.debug("Registered successfully.");
                    _converse.connection.reset();
                    this.showSpinner();

                    if (_.includes(["converse/login", "converse/register"], Backbone.history.getFragment())) {
                        _converse.router.navigate('', {'replace': true});
                    }

                    if (this.fields.password && this.fields.username) {
                        // automatically log the user in
                        _converse.connection.connect(
                            this.fields.username.toLowerCase()+'@'+this.domain.toLowerCase(),
                            this.fields.password,
                            _converse.onConnectStatusChanged
                        );
                        this.giveFeedback(__('Now logging you in'), 'info');
                    } else {
github conversejs / converse.js / src / headless / converse-core.js View on Github external
this.onConnectStatusChanged = function (status, message) {
        log.debug(`Status changed to: ${_converse.CONNECTION_STATUS[status]}`);
        if (status === Strophe.Status.CONNECTED || status === Strophe.Status.ATTACHED) {
            _converse.setConnectionStatus(status);
            // By default we always want to send out an initial presence stanza.
            _converse.send_initial_presence = true;
            _converse.setDisconnectionCause();
            if (_converse.connection.reconnecting) {
                log.debug(status === Strophe.Status.CONNECTED ? 'Reconnected' : 'Reattached');
                onConnected(true);
            } else {
                log.debug(status === Strophe.Status.CONNECTED ? 'Connected' : 'Attached');
                if (_converse.connection.restored) {
                    // No need to send an initial presence stanza when
                    // we're restoring an existing session.
                    _converse.send_initial_presence = false;
                }
                onConnected();
github conversejs / converse.js / src / headless / converse-core.js View on Github external
function finishDisconnection () {
    log.debug('DISCONNECTED');
    delete _converse.connection.reconnecting;
    _converse.connection.reset();
    tearDown();
    clearSession();
    delete _converse.connection;
    /**
     * Triggered after converse.js has disconnected from the XMPP server.
     * @event _converse#disconnected
     * @memberOf _converse
     * @example _converse.api.listen.on('disconnected', () => { ... });
     */
    _converse.api.trigger('disconnected');
}
github conversejs / converse.js / src / headless / converse-core.js View on Github external
    _converse.connection.xmlInput = body => log.debug(body.outerHTML, 'color: darkgoldenrod');
    _converse.connection.xmlOutput = body => log.debug(body.outerHTML, 'color: darkcyan');
github conversejs / converse.js / src / headless / converse-core.js View on Github external
_converse.connection.addHandler((iq) => {
        if (iq.querySelectorAll('error').length > 0) {
            log.warn('An error occurred while trying to enable message carbons.');
        } else {
            _converse.session.save({'carbons_enabled': true});
            log.debug('Message carbons have been enabled.');
        }
    }, null, "iq", null, "enablecarbons");
    _converse.connection.send(carbons_iq);
github conversejs / converse.js / src / headless / converse-core.js View on Github external
function replacePromise (name) {
    const existing_promise = _converse.promises[name];
    if (!existing_promise) {
        throw new Error(`Tried to replace non-existing promise: ${name}`);
    }
    if (existing_promise.replace) {
        const promise = u.getResolveablePromise();
        promise.replace = existing_promise.replace;
        _converse.promises[name] = promise;
    } else {
        log.debug(`Not replacing promise "${name}"`);
    }
}
github conversejs / converse.js / src / headless / converse-core.js View on Github external
    _converse.connection.xmlOutput = body => log.debug(body.outerHTML, 'color: darkcyan');
}