فهرست منبع

Fixes #486 Update docs and fix failing test.

JC Brand 8 سال پیش
والد
کامیت
6d2a38a7c1
4فایلهای تغییر یافته به همراه11 افزوده شده و 6 حذف شده
  1. 1 0
      docs/CHANGES.md
  2. 8 4
      docs/source/configuration.rst
  3. 1 1
      spec/mam.js
  4. 1 1
      src/converse-mam.js

+ 1 - 0
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

+ 8 - 4
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 <https://xmpp.org/extensions/xep-0313.html>`_,
-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 ``undefined``, ``never``, ``always`` and ``roster``.
 
-This option sets the default archiving preference. Valid values are ``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.

+ 1 - 1
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 @@
                     "</iq>"
                 );
 
-                _converse.message_archiving = 'never';
                 /* Example 15. Server responds with current preferences
                  *
                  * <iq type='result' id='juliet2'>

+ 1 - 1
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}),