From 44e5b4c947992610f921e20591d70d1aaa07d1eb Mon Sep 17 00:00:00 2001 From: JC Brand Date: Tue, 24 Sep 2019 15:38:34 +0200 Subject: [PATCH] bosh: only advertise support if the module is enabled updates #1725 --- src/headless/converse-bosh.js | 6 ++++++ src/headless/converse-core.js | 1 - src/headless/converse-disco.js | 1 - 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/headless/converse-bosh.js b/src/headless/converse-bosh.js index af42e9271a..aba763ebb1 100644 --- a/src/headless/converse-bosh.js +++ b/src/headless/converse-bosh.js @@ -8,6 +8,7 @@ * @description * Converse.js plugin which add support for XEP-0206: XMPP Over BOSH */ +import 'strophe.js/src/bosh'; import BrowserStorage from "backbone.browserStorage"; import converse from "./converse-core"; @@ -117,6 +118,11 @@ converse.plugins.add('converse-bosh', { _converse.bosh_session.save({'jid': _converse.jid}); } }); + + _converse.api.listen.on('addClientFeatures', + () => _converse.api.disco.own.features.add(Strophe.NS.BOSH) + ); + /************************ END Event Handlers ************************/ diff --git a/src/headless/converse-core.js b/src/headless/converse-core.js index d656953eff..c7e21f16cc 100644 --- a/src/headless/converse-core.js +++ b/src/headless/converse-core.js @@ -6,7 +6,6 @@ /** * @module converse-core */ -import 'strophe.js/src/bosh'; import 'strophe.js/src/websocket'; import * as strophe from 'strophe.js/src/core'; import Backbone from 'backbone'; diff --git a/src/headless/converse-disco.js b/src/headless/converse-disco.js index 104e747396..7628fde216 100644 --- a/src/headless/converse-disco.js +++ b/src/headless/converse-disco.js @@ -246,7 +246,6 @@ converse.plugins.add('converse-disco', { // See https://xmpp.org/registrar/disco-categories.html _converse.api.disco.own.identities.add('client', 'web', 'Converse'); - _converse.api.disco.own.features.add(Strophe.NS.BOSH); _converse.api.disco.own.features.add(Strophe.NS.CHATSTATES); _converse.api.disco.own.features.add(Strophe.NS.DISCO_INFO); _converse.api.disco.own.features.add(Strophe.NS.ROSTERX); // Limited support