Commit 572d8966 authored by JC Brand's avatar JC Brand

Merge pull request #598 from davec82/master

Add synchronize_presence option
parents 8c06f917 e9349176
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
- #587 Fix issue when logging out with `auto_logout=true` [davec82] - #587 Fix issue when logging out with `auto_logout=true` [davec82]
- #589 Save scroll position on minimize and restore it on maximize [rlanvin] - #589 Save scroll position on minimize and restore it on maximize [rlanvin]
- #592 Add random resource for `auto_login`, add method generateResource to generate random resource [davec82] - #592 Add random resource for `auto_login`, add method generateResource to generate random resource [davec82]
- #598 Add option `synchronize_availability` [davec82]
## 0.10.1 (2016-02-06) ## 0.10.1 (2016-02-06)
......
...@@ -679,6 +679,21 @@ Data in localStorage on the other hand is kept indefinitely. ...@@ -679,6 +679,21 @@ Data in localStorage on the other hand is kept indefinitely.
roster contact statuses will not become out of sync in a single session, roster contact statuses will not become out of sync in a single session,
only across more than one session. only across more than one session.
synchronize_availability
--------------------
* Default: ``true``
Valid options: ``true``, ``false``, ``a resource name``.
This option lets you synchronize your chat status (`online`, `busy`, `away`) with other chat clients. In other words,
if you change your status to `busy` in a different chat client, your status will change to `busy` in converse.js as well.
If set to ``true``, converse.js will synchronize with all other clients you are logged in with.
If set to ``false``, this feature is disabled.
If set to ``a resource name``, converse.js will synchronize only with a client that has that particular resource assigned to it.
use_otr_by_default use_otr_by_default
------------------ ------------------
......
...@@ -335,6 +335,7 @@ ...@@ -335,6 +335,7 @@
sid: undefined, sid: undefined,
sounds_path: '/sounds/', sounds_path: '/sounds/',
storage: 'session', storage: 'session',
synchronize_availability: true, // Set to false to not sync with other clients or with resource name of the particular client that it should synchronize with
use_vcards: true, use_vcards: true,
visible_toolbar_buttons: { visible_toolbar_buttons: {
'emoticons': true, 'emoticons': true,
...@@ -3310,8 +3311,8 @@ ...@@ -3310,8 +3311,8 @@
status_message = $presence.find('status'), status_message = $presence.find('status'),
contact = this.get(bare_jid); contact = this.get(bare_jid);
if (this.isSelf(bare_jid)) { if (this.isSelf(bare_jid)) {
if ((converse.connection.jid !== jid)&&(presence_type !== 'unavailable')) { if ((converse.connection.jid !== jid)&&(presence_type !== 'unavailable')&&(converse.synchronize_availability === true || converse.synchronize_availability === resource)) {
// Another resource has changed its status, we'll update ours as well. // Another resource has changed its status and synchronize_availability option let to update, we'll update ours as well.
converse.xmppstatus.save({'status': chat_status}); converse.xmppstatus.save({'status': chat_status});
if (status_message.length) { converse.xmppstatus.save({'status_message': status_message.text()}); } if (status_message.length) { converse.xmppstatus.save({'status_message': status_message.text()}); }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment