Commit a3407bb9 authored by JC Brand's avatar JC Brand

Move MAM specific code to converse-mam.js

parent dc8cbc61
......@@ -181,12 +181,12 @@
Strophe.addNamespace('CARBONS', 'urn:xmpp:carbons:2');
Strophe.addNamespace('CHATSTATES', 'http://jabber.org/protocol/chatstates');
Strophe.addNamespace('CSI', 'urn:xmpp:csi:0');
Strophe.addNamespace('ROSTERX', 'http://jabber.org/protocol/rosterx');
Strophe.addNamespace('XFORM', 'jabber:x:data');
Strophe.addNamespace('NICK', 'http://jabber.org/protocol/nick');
Strophe.addNamespace('DELAY', 'urn:xmpp:delay');
Strophe.addNamespace('HINTS', 'urn:xmpp:hints');
Strophe.addNamespace('NICK', 'http://jabber.org/protocol/nick');
Strophe.addNamespace('PUBSUB', 'http://jabber.org/protocol/pubsub');
Strophe.addNamespace('DELAY', 'urn:xmpp:delay');
Strophe.addNamespace('ROSTERX', 'http://jabber.org/protocol/rosterx');
Strophe.addNamespace('XFORM', 'jabber:x:data');
// Instance level constants
this.TIMEOUTS = { // Set as module attr so that we can override in tests.
......
......@@ -30,7 +30,6 @@
Strophe.addNamespace('MAM', 'urn:xmpp:mam:0');
Strophe.addNamespace('RSM', 'http://jabber.org/protocol/rsm');
converse.plugins.add('converse-mam', {
overrides: {
......@@ -137,6 +136,17 @@
return result;
},
handleMUCMessage: function (stanza) {
/* MAM (message archive management XEP-0313) messages are
* ignored, since they're handled separately.
*/
var is_mam = $(stanza).find('[xmlns="'+Strophe.NS.MAM+'"]').length > 0;
if (is_mam) {
return true;
}
return this.__super__.handleMUCMessage.apply(this, arguments);
},
fetchArchivedMessages: function (options) {
/* Fetch archived chat messages from the XMPP server.
*
......
......@@ -1020,17 +1020,10 @@
handleMUCMessage: function (stanza) {
/* Handler for all MUC messages sent to this chat room.
*
* MAM (message archive management XEP-0313) messages are
* ignored, since they're handled separately.
*
* Parameters:
* (XMLElement) stanza: The message stanza.
*/
var is_mam = $(stanza).find('[xmlns="'+Strophe.NS.MAM+'"]').length > 0;
if (is_mam) {
return true;
}
var configuration_changed = stanza.querySelector("status[code='104']");
var logging_enabled = stanza.querySelector("status[code='170']");
var logging_disabled = stanza.querySelector("status[code='171']");
......@@ -1374,7 +1367,7 @@
_.each(iq.querySelectorAll('feature'), function (field) {
var fieldname = field.getAttribute('var');
if (!fieldname.startsWith('muc_')) {
if (fieldname === 'urn:xmpp:mam:0') {
if (fieldname === Strophe.NS.MAM) {
features.mam_enabled = true;
}
return;
......
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