From f70a3c3ed22a4b3166a770f12e71172ea326b805 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Tue, 31 May 2016 08:03:06 +0000 Subject: [PATCH] Add new configuration variable: `default_state` --- docs/CHANGES.md | 7 +++---- docs/source/configuration.rst | 9 +++++++++ src/converse-core.js | 7 ++++--- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/docs/CHANGES.md b/docs/CHANGES.md index b59d06c83..ef7420617 100755 --- a/docs/CHANGES.md +++ b/docs/CHANGES.md @@ -2,15 +2,14 @@ ## 1.0.3 (Unreleased) -- Bugfix. Login form doesn't render after logging out, when `auto_reconnect = false` -[jcbrand] +- Bugfix. Login form doesn't render after logging out, when `auto_reconnect = false` [jcbrand] - Also indicate new day for the first day's messages. [jcbrand] -- Chat bot messages don't appear when they have the same ids as their commands. - [jcbrand] +- Chat bot messages don't appear when they have the same ids as their commands. [jcbrand] - Updated onDisconnected method to fire disconnected event even if `auto_reconnect = false`. [kamranzafar] - Bugfix: MAM messages weren't being fetched oldest first. [jcbrand] - Add processing hints to chat state notifications [jcbrand] - Don't use sound and desktop notifications for OTR messages (when setting up the session) [jcbrand] +- New config option [default_state](https://conversejs.org/docs/html/configuration.html#default_state) [jcbrand] - #553 Add processing hints to OTR messages [jcbrand] - #650 Don't ignore incoming messages with same JID as current user (might be MAM archived) [jcbrand] diff --git a/docs/source/configuration.rst b/docs/source/configuration.rst index c5366ac7d..d0e61a357 100644 --- a/docs/source/configuration.rst +++ b/docs/source/configuration.rst @@ -395,6 +395,15 @@ JIDs with other domains are still allowed but need to be provided in full. To specify only one domain and disallow other domains, see the `locked_domain`_ option. +default_state +------------- + +* Default: ``'online'`` + +The default chat status that the user wil have. If you for example set this to +``'chat'``, then converse.js will send out a presence stanza with ``"show"`` +set to ``'chat'`` as soon as you've been logged in. + domain_placeholder ------------------ diff --git a/src/converse-core.js b/src/converse-core.js index 138e3059d..1a48001e5 100755 --- a/src/converse-core.js +++ b/src/converse-core.js @@ -259,6 +259,7 @@ credentials_url: null, // URL from where login credentials can be fetched csi_waiting_time: 0, // Support for XEP-0352. Seconds before client is considered idle and CSI is sent out. debug: false, + default_state: 'online', expose_rid_and_sid: false, filter_by_resource: false, forward_messages: false, @@ -357,7 +358,7 @@ } if (converse.auto_changed_status === true) { converse.auto_changed_status = false; - converse.xmppstatus.setStatus('online'); + converse.xmppstatus.setStatus(converse.default_state); } }; @@ -1431,7 +1432,7 @@ constructPresence: function (type, status_message) { if (typeof type !== 'string') { - type = this.get('status') || 'online'; + type = this.get('status') || converse.default_state; } if (typeof status_message !== 'string') { status_message = this.get('status_message'); @@ -1475,7 +1476,7 @@ }, getStatus: function () { - return this.get('status') || 'online'; + return this.get('status') || converse.default_state; }, setStatusMessage: function (status_message) {