From efa4a9ff23801470f52edcf7cb4009df3a10026a Mon Sep 17 00:00:00 2001 From: JC Brand Date: Mon, 7 Mar 2016 17:16:57 +0000 Subject: [PATCH] Fixes #577 Add a timeout config var for MAM --- docs/CHANGES.md | 1 + docs/source/configuration.rst | 11 +++++++++++ src/converse-core.js | 5 +++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/docs/CHANGES.md b/docs/CHANGES.md index 5c1f33d75..3c44e4f01 100755 --- a/docs/CHANGES.md +++ b/docs/CHANGES.md @@ -13,6 +13,7 @@ - #534 Updated Russian translation [badfiles] - #566 Do not steal the focus when the chatbox opens automatically [rlanvin] - #573 xgettext build error: `'javascript' unknown` [jcbrand] +- #577 New config variable [message_archiving_timeout](https://conversejs.org/docs/html/configuration.html#message_archiving_timeout) [jcbrand] - #587 Fix issue when logging out with `auto_logout=true` [davec82] - #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] diff --git a/docs/source/configuration.rst b/docs/source/configuration.rst index 77f0a8162..1fe2521d1 100644 --- a/docs/source/configuration.rst +++ b/docs/source/configuration.rst @@ -500,6 +500,17 @@ This sets the default archiving preference. Valid values are ``never``, ``always ``roster`` means that only messages to and from JIDs in your roster will be archived. The other two values are self-explanatory. + +message_archiving_timeout +------------------------- + +* Default: ``8000`` + +The amount of time (in milliseconds) to wait when requesting archived messages +from the XMPP server. + +Used in conjunction with `message_archiving` and in context of `XEP-0313: Message Archive Management `_. + message_carbons --------------- diff --git a/src/converse-core.js b/src/converse-core.js index f7fa46852..c591bdb62 100755 --- a/src/converse-core.js +++ b/src/converse-core.js @@ -142,7 +142,7 @@ errback = callback; } if (!converse.features.findWhere({'var': Strophe.NS.MAM})) { - throw new Error('This server does not support XEP-0313, Message Archive Management'); + errback('This server does not support XEP-0313, Message Archive Management'); } var queryid = converse.connection.getUniqueId(); var attrs = {'type':'set'}; @@ -196,7 +196,7 @@ return false; // There's no callback, so no use in continuing this handler. } }, Strophe.NS.MAM); - converse.connection.sendIQ(stanza, null, errback); + converse.connection.sendIQ(stanza, null, errback, converse.message_archiving_timeout); }; @@ -370,6 +370,7 @@ keepalive: false, locked_domain: undefined, message_archiving: 'never', // Supported values are 'always', 'never', 'roster' (See https://xmpp.org/extensions/xep-0313.html#prefs ) + message_archiving_timeout: 8000, // The amount of time (in milliseconds) to wait before aborting a MAM (XEP-0313) request message_carbons: false, // Support for XEP-280 no_trimming: false, // Set to true for phantomjs tests (where browser apparently has no width) password: undefined,