Commit 561c138e authored by JC Brand's avatar JC Brand

Bugfix. Allow multiple MAM queries to be made simultaneously.

parent e28aba5a
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
list. [jcbrand] list. [jcbrand]
- #645 When accepting a contact request, the contact didn't appear in the - #645 When accepting a contact request, the contact didn't appear in the
pending contacts group. [jcbrand] pending contacts group. [jcbrand]
- Bugfix: allow multiple MAM queries to be made simultaneously. [jcbrand]
## 1.0.4 (2016-07-26) ## 1.0.4 (2016-07-26)
......
...@@ -348,7 +348,7 @@ ...@@ -348,7 +348,7 @@
* </fin> * </fin>
* </message> * </message>
*/ */
stanza = $msg().c('fin', {'xmlns': 'urn:xmpp:mam:0', 'complete': 'true'}) stanza = $msg().c('fin', {'xmlns': 'urn:xmpp:mam:0', 'queryid':queryid, 'complete': 'true'})
.c('set', {'xmlns': 'http://jabber.org/protocol/rsm'}) .c('set', {'xmlns': 'http://jabber.org/protocol/rsm'})
.c('first', {'index': '0'}).t('23452-4534-1').up() .c('first', {'index': '0'}).t('23452-4534-1').up()
.c('last').t('390-2342-22').up() .c('last').t('390-2342-22').up()
......
...@@ -203,11 +203,12 @@ ...@@ -203,11 +203,12 @@
stanza.cnode(new Strophe.RSM(options).toXML()); stanza.cnode(new Strophe.RSM(options).toXML());
} }
} }
converse.connection.addHandler(function (message) {
var $msg = $(message), $fin, rsm; if (typeof callback === "function") {
if (typeof callback === "function") { converse.connection.addHandler(function (message) {
$fin = $msg.find('fin[xmlns="'+Strophe.NS.MAM+'"]'); var $msg = $(message), rsm,
if ($fin.length) { $fin = $msg.find('fin[xmlns="'+Strophe.NS.MAM+'"]');
if ($fin.length && $fin.attr('queryid') === queryid) {
rsm = new Strophe.RSM({xml: $fin.find('set')[0]}); rsm = new Strophe.RSM({xml: $fin.find('set')[0]});
_.extend(rsm, _.pick(options, ['max'])); _.extend(rsm, _.pick(options, ['max']));
_.extend(rsm, _.pick(options, MAM_ATTRIBUTES)); _.extend(rsm, _.pick(options, MAM_ATTRIBUTES));
...@@ -217,10 +218,8 @@ ...@@ -217,10 +218,8 @@
messages.push(message); messages.push(message);
} }
return true; return true;
} else { }, Strophe.NS.MAM);
return false; // There's no callback, so no use in continuing this handler. }
}
}, Strophe.NS.MAM);
converse.connection.sendIQ(stanza, null, errback, converse.message_archiving_timeout); converse.connection.sendIQ(stanza, null, errback, converse.message_archiving_timeout);
}; };
......
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