Move `csi_waiting_time` setting to the `converse-status` plugin

This commit is contained in:
JC Brand 2022-04-04 13:14:17 +02:00
parent 2fa1d00fb4
commit b429484501
4 changed files with 10 additions and 8 deletions

View File

@ -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) <https://modules.prosody.im/mod_ogp.html`_
for which `Open Graph Protocol (OGP) <https://modules.prosody.im/mod_ogp.html>`_
data was received (for example via Prosody's `mod_ogp <https://modules.prosody.im/mod_ogp.html>`_).
The OGP metadata must come from the MUC itself, metadata sent from participants

View File

@ -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);

View File

@ -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();

View File

@ -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',