Commit 4e491ac5 authored by JC Brand's avatar JC Brand

Regenerated dist files.

parent 02a055d3
...@@ -56344,6 +56344,7 @@ Strophe.addConnectionPlugin('disco', ...@@ -56344,6 +56344,7 @@ Strophe.addConnectionPlugin('disco',
'from': stanza.getAttribute('from') 'from': stanza.getAttribute('from')
}); });
}); });
this.trigger('featuresDiscovered');
} }
}); });
...@@ -56357,7 +56358,7 @@ Strophe.addConnectionPlugin('disco', ...@@ -56357,7 +56358,7 @@ Strophe.addConnectionPlugin('disco',
this.fetchEntities().then( this.fetchEntities().then(
_.partial(_converse.emit, 'discoInitialized'), _.partial(_converse.emit, 'discoInitialized'),
_.partial(_converse.emit, 'discoInitialized') _.partial(_converse.emit, 'discoInitialized')
); ).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
}, },
fetchEntities () { fetchEntities () {
...@@ -61953,6 +61954,7 @@ Strophe.RSM.prototype = { ...@@ -61953,6 +61954,7 @@ Strophe.RSM.prototype = {
"use strict"; "use strict";
var _converse$env = converse.env, var _converse$env = converse.env,
Promise = _converse$env.Promise,
Strophe = _converse$env.Strophe, Strophe = _converse$env.Strophe,
$iq = _converse$env.$iq, $iq = _converse$env.$iq,
_ = _converse$env._, _ = _converse$env._,
...@@ -61963,6 +61965,31 @@ Strophe.RSM.prototype = { ...@@ -61963,6 +61965,31 @@ Strophe.RSM.prototype = {
// XEP-0313 Message Archive Management // XEP-0313 Message Archive Management
var MAM_ATTRIBUTES = ['with', 'start', 'end']; var MAM_ATTRIBUTES = ['with', 'start', 'end'];
function checkMAMSupport(_converse) {
/* Returns a promise which resolves when MAM is supported
* for this user, or which rejects if not.
*/
return _converse.api.waitUntil('discoInitialized').then(function () {
return new Promise(function (resolve, reject) {
function fulfillPromise(entity) {
if (entity.features.findWhere({ 'var': Strophe.NS.MAM })) {
resolve(true);
} else {
resolve(false);
}
}
var entity = _converse.disco_entities.get(_converse.bare_jid);
if (_.isUndefined(entity)) {
entity = _converse.disco_entities.create({ 'jid': _converse.bare_jid });
entity.on('featuresDiscovered', _.partial(fulfillPromise, entity));
} else {
fulfillPromise(entity);
}
});
});
}
converse.plugins.add('converse-mam', { converse.plugins.add('converse-mam', {
overrides: { overrides: {
...@@ -61988,20 +62015,35 @@ Strophe.RSM.prototype = { ...@@ -61988,20 +62015,35 @@ Strophe.RSM.prototype = {
return result; return result;
}, },
fetchArchivedMessagesIfNecessary: function fetchArchivedMessagesIfNecessary() { fetchArchivedMessagesIfNecessary: function fetchArchivedMessagesIfNecessary() {
/* Check if archived messages should be fetched, and if so, do so. */ var _this = this;
var _converse = this.__super__._converse,
entity = _converse.disco_entities.get(_converse.domain),
server_supports_mam = entity.features.findWhere({ 'var': Strophe.NS.MAM });
if (this.disable_mam || !server_supports_mam || this.model.get('mam_initialized')) { /* Check if archived messages should be fetched, and if so, do so. */
if (this.disable_mam || this.model.get('mam_initialized')) {
return; return;
} }
this.fetchArchivedMessages(); var _converse = this.__super__._converse;
this.model.save({ 'mam_initialized': true });
this.addSpinner();
checkMAMSupport(_converse).then(function (supported) {
// Success
if (supported) {
_this.fetchArchivedMessages();
} else {
_this.clearSpinner();
}
_this.model.save({ 'mam_initialized': true });
}, function () {
// Error
_this.clearSpinner();
_converse.log("Error or timeout while checking for MAM support", Strophe.LogLevel.ERROR);
}).catch(function (msg) {
_this.clearSpinner();
_converse.log(msg, Strophe.LogLevel.FATAL);
});
}, },
fetchArchivedMessages: function fetchArchivedMessages(options) { fetchArchivedMessages: function fetchArchivedMessages(options) {
var _this = this; var _this2 = this;
/* Fetch archived chat messages from the XMPP server. /* Fetch archived chat messages from the XMPP server.
* *
...@@ -62010,7 +62052,7 @@ Strophe.RSM.prototype = { ...@@ -62010,7 +62052,7 @@ Strophe.RSM.prototype = {
*/ */
var _converse = this.__super__._converse; var _converse = this.__super__._converse;
if (!_converse.disco_entities.get(_converse.domain).features.findWhere({ 'var': Strophe.NS.MAM })) { if (!_converse.disco_entities.get(_converse.bare_jid).features.findWhere({ 'var': Strophe.NS.MAM })) {
_converse.log("Attempted to fetch archived messages but this " + "user's server doesn't support XEP-0313", Strophe.LogLevel.WARN); _converse.log("Attempted to fetch archived messages but this " + "user's server doesn't support XEP-0313", Strophe.LogLevel.WARN);
return; return;
...@@ -62025,13 +62067,13 @@ Strophe.RSM.prototype = { ...@@ -62025,13 +62067,13 @@ Strophe.RSM.prototype = {
'with': this.model.get('jid') 'with': this.model.get('jid')
}, options), function (messages) { }, options), function (messages) {
// Success // Success
_this.clearSpinner(); _this2.clearSpinner();
if (messages.length) { if (messages.length) {
_.each(messages, _converse.chatboxes.onMessage.bind(_converse.chatboxes)); _.each(messages, _converse.chatboxes.onMessage.bind(_converse.chatboxes));
} }
}, function () { }, function () {
// Error // Error
_this.clearSpinner(); _this2.clearSpinner();
_converse.log("Error or timeout while trying to fetch " + "archived messages", Strophe.LogLevel.ERROR); _converse.log("Error or timeout while trying to fetch " + "archived messages", Strophe.LogLevel.ERROR);
}); });
}, },
...@@ -62265,7 +62307,7 @@ Strophe.RSM.prototype = { ...@@ -62265,7 +62307,7 @@ Strophe.RSM.prototype = {
}); });
_converse.on('afterMessagesFetched', function (chatboxview) { _converse.on('afterMessagesFetched', function (chatboxview) {
_converse.api.waitUntil('discoInitialized').then(chatboxview.fetchArchivedMessagesIfNecessary.bind(chatboxview)).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL)); chatboxview.fetchArchivedMessagesIfNecessary();
}); });
} }
}); });
...@@ -16110,6 +16110,7 @@ return __p ...@@ -16110,6 +16110,7 @@ return __p
'from': stanza.getAttribute('from') 'from': stanza.getAttribute('from')
}); });
}); });
this.trigger('featuresDiscovered');
} }
}); });
...@@ -16123,7 +16124,7 @@ return __p ...@@ -16123,7 +16124,7 @@ return __p
this.fetchEntities().then( this.fetchEntities().then(
_.partial(_converse.emit, 'discoInitialized'), _.partial(_converse.emit, 'discoInitialized'),
_.partial(_converse.emit, 'discoInitialized') _.partial(_converse.emit, 'discoInitialized')
); ).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
}, },
fetchEntities () { fetchEntities () {
...@@ -19618,6 +19619,7 @@ return __p ...@@ -19618,6 +19619,7 @@ return __p
"use strict"; "use strict";
var _converse$env = converse.env, var _converse$env = converse.env,
Promise = _converse$env.Promise,
Strophe = _converse$env.Strophe, Strophe = _converse$env.Strophe,
$iq = _converse$env.$iq, $iq = _converse$env.$iq,
_ = _converse$env._, _ = _converse$env._,
...@@ -19628,6 +19630,31 @@ return __p ...@@ -19628,6 +19630,31 @@ return __p
// XEP-0313 Message Archive Management // XEP-0313 Message Archive Management
var MAM_ATTRIBUTES = ['with', 'start', 'end']; var MAM_ATTRIBUTES = ['with', 'start', 'end'];
function checkMAMSupport(_converse) {
/* Returns a promise which resolves when MAM is supported
* for this user, or which rejects if not.
*/
return _converse.api.waitUntil('discoInitialized').then(function () {
return new Promise(function (resolve, reject) {
function fulfillPromise(entity) {
if (entity.features.findWhere({ 'var': Strophe.NS.MAM })) {
resolve(true);
} else {
resolve(false);
}
}
var entity = _converse.disco_entities.get(_converse.bare_jid);
if (_.isUndefined(entity)) {
entity = _converse.disco_entities.create({ 'jid': _converse.bare_jid });
entity.on('featuresDiscovered', _.partial(fulfillPromise, entity));
} else {
fulfillPromise(entity);
}
});
});
}
converse.plugins.add('converse-mam', { converse.plugins.add('converse-mam', {
overrides: { overrides: {
...@@ -19653,20 +19680,35 @@ return __p ...@@ -19653,20 +19680,35 @@ return __p
return result; return result;
}, },
fetchArchivedMessagesIfNecessary: function fetchArchivedMessagesIfNecessary() { fetchArchivedMessagesIfNecessary: function fetchArchivedMessagesIfNecessary() {
/* Check if archived messages should be fetched, and if so, do so. */ var _this = this;
var _converse = this.__super__._converse,
entity = _converse.disco_entities.get(_converse.domain),
server_supports_mam = entity.features.findWhere({ 'var': Strophe.NS.MAM });
if (this.disable_mam || !server_supports_mam || this.model.get('mam_initialized')) { /* Check if archived messages should be fetched, and if so, do so. */
if (this.disable_mam || this.model.get('mam_initialized')) {
return; return;
} }
this.fetchArchivedMessages(); var _converse = this.__super__._converse;
this.model.save({ 'mam_initialized': true });
this.addSpinner();
checkMAMSupport(_converse).then(function (supported) {
// Success
if (supported) {
_this.fetchArchivedMessages();
} else {
_this.clearSpinner();
}
_this.model.save({ 'mam_initialized': true });
}, function () {
// Error
_this.clearSpinner();
_converse.log("Error or timeout while checking for MAM support", Strophe.LogLevel.ERROR);
}).catch(function (msg) {
_this.clearSpinner();
_converse.log(msg, Strophe.LogLevel.FATAL);
});
}, },
fetchArchivedMessages: function fetchArchivedMessages(options) { fetchArchivedMessages: function fetchArchivedMessages(options) {
var _this = this; var _this2 = this;
/* Fetch archived chat messages from the XMPP server. /* Fetch archived chat messages from the XMPP server.
* *
...@@ -19675,7 +19717,7 @@ return __p ...@@ -19675,7 +19717,7 @@ return __p
*/ */
var _converse = this.__super__._converse; var _converse = this.__super__._converse;
if (!_converse.disco_entities.get(_converse.domain).features.findWhere({ 'var': Strophe.NS.MAM })) { if (!_converse.disco_entities.get(_converse.bare_jid).features.findWhere({ 'var': Strophe.NS.MAM })) {
_converse.log("Attempted to fetch archived messages but this " + "user's server doesn't support XEP-0313", Strophe.LogLevel.WARN); _converse.log("Attempted to fetch archived messages but this " + "user's server doesn't support XEP-0313", Strophe.LogLevel.WARN);
return; return;
...@@ -19690,13 +19732,13 @@ return __p ...@@ -19690,13 +19732,13 @@ return __p
'with': this.model.get('jid') 'with': this.model.get('jid')
}, options), function (messages) { }, options), function (messages) {
// Success // Success
_this.clearSpinner(); _this2.clearSpinner();
if (messages.length) { if (messages.length) {
_.each(messages, _converse.chatboxes.onMessage.bind(_converse.chatboxes)); _.each(messages, _converse.chatboxes.onMessage.bind(_converse.chatboxes));
} }
}, function () { }, function () {
// Error // Error
_this.clearSpinner(); _this2.clearSpinner();
_converse.log("Error or timeout while trying to fetch " + "archived messages", Strophe.LogLevel.ERROR); _converse.log("Error or timeout while trying to fetch " + "archived messages", Strophe.LogLevel.ERROR);
}); });
}, },
...@@ -19930,7 +19972,7 @@ return __p ...@@ -19930,7 +19972,7 @@ return __p
}); });
_converse.on('afterMessagesFetched', function (chatboxview) { _converse.on('afterMessagesFetched', function (chatboxview) {
_converse.api.waitUntil('discoInitialized').then(chatboxview.fetchArchivedMessagesIfNecessary.bind(chatboxview)).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL)); chatboxview.fetchArchivedMessagesIfNecessary();
}); });
} }
}); });
...@@ -49781,8 +49781,7 @@ return Backbone.BrowserStorage; ...@@ -49781,8 +49781,7 @@ return Backbone.BrowserStorage;
}; };
this.giveFeedback = function (subject, klass, message) { this.giveFeedback = function (subject, klass, message) {
var els = document.querySelectorAll('.conn-feedback'); _.forEach(document.querySelectorAll('.conn-feedback'), function (el) {
_.forEach(els, function (el) {
el.classList.add('conn-feedback'); el.classList.add('conn-feedback');
el.textContent = subject; el.textContent = subject;
if (klass) { if (klass) {
...@@ -54092,7 +54091,7 @@ return __p ...@@ -54092,7 +54091,7 @@ return __p
initialize: function initialize() { initialize: function initialize() {
this.model.on('change:current_skintone', this.render, this); this.model.on('change:current_skintone', this.render, this);
this.model.on('change:current_category', this.render, this); this.model.on('change:current_category', this.render, this);
this.setScrollPosition = _.debounce(this.setScrollPosition, 50); this.setScrollPosition = _.debounce(this.setScrollPosition, 50).bind(this);
}, },
render: function render() { render: function render() {
var _this = this; var _this = this;
...@@ -54105,8 +54104,8 @@ return __p ...@@ -54105,8 +54104,8 @@ return __p
'shouldBeHidden': this.shouldBeHidden 'shouldBeHidden': this.shouldBeHidden
})); }));
this.el.innerHTML = emojis_html; this.el.innerHTML = emojis_html;
this.el.querySelectorAll('.emoji-picker').forEach(function (el) { _.forEach(this.el.querySelectorAll('.emoji-picker'), function (el) {
el.addEventListener('scroll', _this.setScrollPosition.bind(_this)); el.addEventListener('scroll', _this.setScrollPosition);
}); });
this.restoreScrollPosition(); this.restoreScrollPosition();
return this; return this;
...@@ -54133,7 +54132,7 @@ return __p ...@@ -54133,7 +54132,7 @@ return __p
current_picker[0].scrollTop = this.model.get('scroll_position'); current_picker[0].scrollTop = this.model.get('scroll_position');
} }
}, },
setScrollPosition: function setScrollPosition(ev, position) { setScrollPosition: function setScrollPosition(ev) {
this.model.save('scroll_position', ev.target.scrollTop); this.model.save('scroll_position', ev.target.scrollTop);
}, },
chooseSkinTone: function chooseSkinTone(ev) { chooseSkinTone: function chooseSkinTone(ev) {
...@@ -58503,6 +58502,7 @@ Strophe.addConnectionPlugin('disco', ...@@ -58503,6 +58502,7 @@ Strophe.addConnectionPlugin('disco',
'from': stanza.getAttribute('from') 'from': stanza.getAttribute('from')
}); });
}); });
this.trigger('featuresDiscovered');
} }
}); });
...@@ -58516,7 +58516,7 @@ Strophe.addConnectionPlugin('disco', ...@@ -58516,7 +58516,7 @@ Strophe.addConnectionPlugin('disco',
this.fetchEntities().then( this.fetchEntities().then(
_.partial(_converse.emit, 'discoInitialized'), _.partial(_converse.emit, 'discoInitialized'),
_.partial(_converse.emit, 'discoInitialized') _.partial(_converse.emit, 'discoInitialized')
); ).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
}, },
fetchEntities () { fetchEntities () {
...@@ -60985,7 +60985,10 @@ Strophe.addConnectionPlugin('disco', ...@@ -60985,7 +60985,10 @@ Strophe.addConnectionPlugin('disco',
}, },
openChatRoom: function openChatRoom(ev) { openChatRoom: function openChatRoom(ev) {
ev.preventDefault(); ev.preventDefault();
_converse.openChatRoom(this.parseRoomDataFromEvent(ev)); var data = this.parseRoomDataFromEvent(ev);
if (!_.isUndefined(data)) {
_converse.openChatRoom(data);
}
}, },
setDomain: function setDomain(ev) { setDomain: function setDomain(ev) {
this.model.save({ muc_domain: ev.target.value }); this.model.save({ muc_domain: ev.target.value });
...@@ -58502,6 +58502,7 @@ Strophe.addConnectionPlugin('disco', ...@@ -58502,6 +58502,7 @@ Strophe.addConnectionPlugin('disco',
'from': stanza.getAttribute('from') 'from': stanza.getAttribute('from')
}); });
}); });
this.trigger('featuresDiscovered');
} }
}); });
...@@ -58515,7 +58516,7 @@ Strophe.addConnectionPlugin('disco', ...@@ -58515,7 +58516,7 @@ Strophe.addConnectionPlugin('disco',
this.fetchEntities().then( this.fetchEntities().then(
_.partial(_converse.emit, 'discoInitialized'), _.partial(_converse.emit, 'discoInitialized'),
_.partial(_converse.emit, 'discoInitialized') _.partial(_converse.emit, 'discoInitialized')
); ).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
}, },
fetchEntities () { fetchEntities () {
...@@ -62091,6 +62092,7 @@ Strophe.RSM.prototype = { ...@@ -62091,6 +62092,7 @@ Strophe.RSM.prototype = {
"use strict"; "use strict";
var _converse$env = converse.env, var _converse$env = converse.env,
Promise = _converse$env.Promise,
Strophe = _converse$env.Strophe, Strophe = _converse$env.Strophe,
$iq = _converse$env.$iq, $iq = _converse$env.$iq,
_ = _converse$env._, _ = _converse$env._,
...@@ -62101,6 +62103,31 @@ Strophe.RSM.prototype = { ...@@ -62101,6 +62103,31 @@ Strophe.RSM.prototype = {
// XEP-0313 Message Archive Management // XEP-0313 Message Archive Management
var MAM_ATTRIBUTES = ['with', 'start', 'end']; var MAM_ATTRIBUTES = ['with', 'start', 'end'];
function checkMAMSupport(_converse) {
/* Returns a promise which resolves when MAM is supported
* for this user, or which rejects if not.
*/
return _converse.api.waitUntil('discoInitialized').then(function () {
return new Promise(function (resolve, reject) {
function fulfillPromise(entity) {
if (entity.features.findWhere({ 'var': Strophe.NS.MAM })) {
resolve(true);
} else {
resolve(false);
}
}
var entity = _converse.disco_entities.get(_converse.bare_jid);
if (_.isUndefined(entity)) {
entity = _converse.disco_entities.create({ 'jid': _converse.bare_jid });
entity.on('featuresDiscovered', _.partial(fulfillPromise, entity));
} else {
fulfillPromise(entity);
}
});
});
}
converse.plugins.add('converse-mam', { converse.plugins.add('converse-mam', {
overrides: { overrides: {
...@@ -62126,20 +62153,35 @@ Strophe.RSM.prototype = { ...@@ -62126,20 +62153,35 @@ Strophe.RSM.prototype = {
return result; return result;
}, },
fetchArchivedMessagesIfNecessary: function fetchArchivedMessagesIfNecessary() { fetchArchivedMessagesIfNecessary: function fetchArchivedMessagesIfNecessary() {
/* Check if archived messages should be fetched, and if so, do so. */ var _this = this;
var _converse = this.__super__._converse,
entity = _converse.disco_entities.get(_converse.domain),
server_supports_mam = entity.features.findWhere({ 'var': Strophe.NS.MAM });
if (this.disable_mam || !server_supports_mam || this.model.get('mam_initialized')) { /* Check if archived messages should be fetched, and if so, do so. */
if (this.disable_mam || this.model.get('mam_initialized')) {
return; return;
} }
this.fetchArchivedMessages(); var _converse = this.__super__._converse;
this.model.save({ 'mam_initialized': true });
this.addSpinner();
checkMAMSupport(_converse).then(function (supported) {
// Success
if (supported) {
_this.fetchArchivedMessages();
} else {
_this.clearSpinner();
}
_this.model.save({ 'mam_initialized': true });
}, function () {
// Error
_this.clearSpinner();
_converse.log("Error or timeout while checking for MAM support", Strophe.LogLevel.ERROR);
}).catch(function (msg) {
_this.clearSpinner();
_converse.log(msg, Strophe.LogLevel.FATAL);
});
}, },
fetchArchivedMessages: function fetchArchivedMessages(options) { fetchArchivedMessages: function fetchArchivedMessages(options) {
var _this = this; var _this2 = this;
/* Fetch archived chat messages from the XMPP server. /* Fetch archived chat messages from the XMPP server.
* *
...@@ -62148,7 +62190,7 @@ Strophe.RSM.prototype = { ...@@ -62148,7 +62190,7 @@ Strophe.RSM.prototype = {
*/ */
var _converse = this.__super__._converse; var _converse = this.__super__._converse;
if (!_converse.disco_entities.get(_converse.domain).features.findWhere({ 'var': Strophe.NS.MAM })) { if (!_converse.disco_entities.get(_converse.bare_jid).features.findWhere({ 'var': Strophe.NS.MAM })) {
_converse.log("Attempted to fetch archived messages but this " + "user's server doesn't support XEP-0313", Strophe.LogLevel.WARN); _converse.log("Attempted to fetch archived messages but this " + "user's server doesn't support XEP-0313", Strophe.LogLevel.WARN);
return; return;
...@@ -62163,13 +62205,13 @@ Strophe.RSM.prototype = { ...@@ -62163,13 +62205,13 @@ Strophe.RSM.prototype = {
'with': this.model.get('jid') 'with': this.model.get('jid')
}, options), function (messages) { }, options), function (messages) {
// Success // Success
_this.clearSpinner(); _this2.clearSpinner();
if (messages.length) { if (messages.length) {
_.each(messages, _converse.chatboxes.onMessage.bind(_converse.chatboxes)); _.each(messages, _converse.chatboxes.onMessage.bind(_converse.chatboxes));
} }
}, function () { }, function () {
// Error // Error
_this.clearSpinner(); _this2.clearSpinner();
_converse.log("Error or timeout while trying to fetch " + "archived messages", Strophe.LogLevel.ERROR); _converse.log("Error or timeout while trying to fetch " + "archived messages", Strophe.LogLevel.ERROR);
}); });
}, },
...@@ -62403,7 +62445,7 @@ Strophe.RSM.prototype = { ...@@ -62403,7 +62445,7 @@ Strophe.RSM.prototype = {
}); });
_converse.on('afterMessagesFetched', function (chatboxview) { _converse.on('afterMessagesFetched', function (chatboxview) {
_converse.api.waitUntil('discoInitialized').then(chatboxview.fetchArchivedMessagesIfNecessary.bind(chatboxview)).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL)); chatboxview.fetchArchivedMessagesIfNecessary();
}); });
} }
}); });
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