From 6d2a38a7c12678582cb58c52600c6ae3f6d79039 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Sun, 12 Feb 2017 19:01:07 +0000 Subject: [PATCH] Fixes #486 Update docs and fix failing test. --- docs/CHANGES.md | 1 + docs/source/configuration.rst | 12 ++++++++---- spec/mam.js | 2 +- src/converse-mam.js | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/docs/CHANGES.md b/docs/CHANGES.md index 06b397011..1649f1eec 100755 --- a/docs/CHANGES.md +++ b/docs/CHANGES.md @@ -7,6 +7,7 @@ - *Breaking change*: Callbacks for `converse.on` now no longer receive an event object as first parameter. [jcbrand] - Use lodash instead of underscore.js [jcbrand] +- #486 Honor existing mam user configuration [throwaway42] ## 2.0.5 (Unreleased) - #743, #751, #753 Update to Strophe 1.2.12. SASL-EXTERNAL now has reduced priority, so it won't diff --git a/docs/source/configuration.rst b/docs/source/configuration.rst index 1095a78a0..90b068c65 100644 --- a/docs/source/configuration.rst +++ b/docs/source/configuration.rst @@ -656,13 +656,17 @@ Similar to `default_domain`_ but no other domains are allowed. message_archiving ----------------- -* Default: ``never`` +* Default: ``undefined`` Provides support for `XEP-0313: Message Archive Management `_, -whereby messages are archived in the XMPP server for later retrieval. Note, your XMPP server must support -XEP-0313 MAM for this to work. +whereby messages are archived in the XMPP server for later retrieval. +Note, your XMPP server must support XEP-0313 MAM for this to work. -This option sets the default archiving preference. Valid values are ``never``, ``always`` and ``roster``. +This option sets the default archiving preference. +Valid values are ``undefined``, ``never``, ``always`` and ``roster``. + +``undefined`` means that any existing MAM configuration, as set by the user or +the server administrator, will be used. ``roster`` means that only messages to and from JIDs in your roster will be archived. The other two values are self-explanatory. diff --git a/spec/mam.js b/spec/mam.js index 268fee253..5c73ba068 100644 --- a/spec/mam.js +++ b/spec/mam.js @@ -375,6 +375,7 @@ IQ_id = sendIQ.bind(this)(iq, callback, errback); }); spyOn(_converse, 'onMAMPreferences').andCallThrough(); + _converse.message_archiving = 'never'; var feature = new _converse.Feature({ 'var': Strophe.NS.MAM @@ -389,7 +390,6 @@ "" ); - _converse.message_archiving = 'never'; /* Example 15. Server responds with current preferences * * diff --git a/src/converse-mam.js b/src/converse-mam.js index 80fcf6144..0c454b41b 100644 --- a/src/converse-mam.js +++ b/src/converse-mam.js @@ -287,7 +287,7 @@ var prefs = feature.get('preferences') || {}; if (feature.get('var') === Strophe.NS.MAM && prefs['default'] !== _converse.message_archiving && - _converse.message_archiving ) { + !_.isUndefined(_converse.message_archiving) ) { // Ask the server for archiving preferences _converse.connection.sendIQ( $iq({'type': 'get'}).c('prefs', {'xmlns': Strophe.NS.MAM}),