diff --git a/docs/source/configuration.rst b/docs/source/configuration.rst index 855e58622..b08849e12 100644 --- a/docs/source/configuration.rst +++ b/docs/source/configuration.rst @@ -1833,7 +1833,7 @@ Setting it to an array of domains means that media will be rendered only for URL matching those domains. Media URLs are those URLs which appear to point to media files as well as URLs -for which `Open Graph Protocol (OGP) `_ data was received (for example via Prosody's `mod_ogp `_). The OGP metadata must come from the MUC itself, metadata sent from participants diff --git a/src/headless/core.js b/src/headless/core.js index d20c6850f..3a23280f4 100644 --- a/src/headless/core.js +++ b/src/headless/core.js @@ -53,7 +53,6 @@ Strophe.addNamespace('FASTEN', 'urn:xmpp:fasten:0'); Strophe.addNamespace('FORWARD', 'urn:xmpp:forward:0'); Strophe.addNamespace('HINTS', 'urn:xmpp:hints'); Strophe.addNamespace('HTTPUPLOAD', 'urn:xmpp:http:upload:0'); -Strophe.addNamespace('IDLE', 'urn:xmpp:idle:1'); Strophe.addNamespace('MAM', 'urn:xmpp:mam:2'); Strophe.addNamespace('MARKERS', 'urn:xmpp:chat-markers:0'); Strophe.addNamespace('MENTIONS', 'urn:xmpp:mmn:0'); @@ -728,10 +727,6 @@ Object.assign(converse, { log.error(e); } - if (api.settings.get("idle_presence_timeout") > 0) { - api.listen.on('addClientFeatures', () => api.disco.own.features.add(Strophe.NS.IDLE)); - } - const plugins = _converse.pluggable.plugins if (api.settings.get("auto_login") || api.settings.get("keepalive") && invoke(plugins['converse-bosh'], 'enabled')) { await api.user.login(null, null, true); diff --git a/src/headless/plugins/status/index.js b/src/headless/plugins/status/index.js index 57f51d487..0a5f8cd16 100644 --- a/src/headless/plugins/status/index.js +++ b/src/headless/plugins/status/index.js @@ -7,6 +7,10 @@ import status_api from './api.js'; import { _converse, api, converse } from '@converse/headless/core'; import { initStatus, onEverySecond, onUserActivity, registerIntervalHandler, sendCSI } from './utils.js'; +const { Strophe } = converse.env; + +Strophe.addNamespace('IDLE', 'urn:xmpp:idle:1'); + converse.plugins.add('converse-status', { @@ -17,6 +21,7 @@ converse.plugins.add('converse-status', { auto_xa: 0, // Seconds after which user status is set to 'xa' csi_waiting_time: 0, // Support for XEP-0352. Seconds before client is considered idle and CSI is sent out. default_state: 'online', + idle_presence_timeout: 300, // Seconds after which an idle presence is sent priority: 0, }); api.promises.add(['statusInitialized']); @@ -29,6 +34,10 @@ converse.plugins.add('converse-status', { Object.assign(_converse.api.user, status_api); + if (api.settings.get("idle_presence_timeout") > 0) { + api.listen.on('addClientFeatures', () => api.disco.own.features.add(Strophe.NS.IDLE)); + } + api.listen.on('presencesInitialized', (reconnecting) => { if (!reconnecting) { _converse.registerIntervalHandler(); diff --git a/src/headless/shared/settings/constants.js b/src/headless/shared/settings/constants.js index a7017a091..6474ba41a 100644 --- a/src/headless/shared/settings/constants.js +++ b/src/headless/shared/settings/constants.js @@ -15,7 +15,6 @@ * @property { RegExp } [geouri_regex] * @property { RegExp } [geouri_replacement='https - //www.openstreetmap.org/?mlat=$1&mlon=$2#map=18/$1/$2'] * @property { String } [i18n] - * @property { Number } [idle_presence_timeout=300] - Seconds after which an idle presence is sent * @property { String } [jid] * @property { Boolean } [keepalive=true] * @property { ('debug'|'info'|'eror') } [loglevel='info'] @@ -47,7 +46,6 @@ export const DEFAULT_SETTINGS = { geouri_regex: /https\:\/\/www.openstreetmap.org\/.*#map=[0-9]+\/([\-0-9.]+)\/([\-0-9.]+)\S*/g, geouri_replacement: 'https://www.openstreetmap.org/?mlat=$1&mlon=$2#map=18/$1/$2', i18n: undefined, - idle_presence_timeout: 300, // Seconds after which an idle presence is sent jid: undefined, keepalive: true, loglevel: 'info',