|
@@ -62522,7 +62522,11 @@ _lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.templateSettings = {
|
|
|
'imports': {
|
|
|
'_': _lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a
|
|
|
}
|
|
|
-};
|
|
|
+}; // Setting wait to 59 instead of 60 to avoid timing conflicts with the
|
|
|
+// webserver, which is often also set to 60 and might therefore sometimes
|
|
|
+// return a 504 error page instead of passing through to the BOSH proxy.
|
|
|
+
|
|
|
+const BOSH_WAIT = 59;
|
|
|
/**
|
|
|
* A private, closured object containing the private api (via `_converse.api`)
|
|
|
* as well as private methods and internal data-structures.
|
|
@@ -62534,18 +62538,16 @@ const _converse = {
|
|
|
'templates': {},
|
|
|
'promises': {}
|
|
|
};
|
|
|
+_converse.VERSION_NAME = "v4.0.5";
|
|
|
|
|
|
-_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.extend(_converse, Backbone.Events);
|
|
|
+_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.extend(_converse, Backbone.Events); // Make converse pluggable
|
|
|
|
|
|
-_converse.VERSION_NAME = "v4.0.5"; // Core plugins are whitelisted automatically
|
|
|
-
|
|
|
-_converse.core_plugins = ['converse-chatboxes', 'converse-core', 'converse-disco', 'converse-mam', 'converse-muc', 'converse-ping', 'converse-roster', 'converse-vcard']; // Setting wait to 59 instead of 60 to avoid timing conflicts with the
|
|
|
-// webserver, which is often also set to 60 and might therefore sometimes
|
|
|
-// return a 504 error page instead of passing through to the BOSH proxy.
|
|
|
|
|
|
-const BOSH_WAIT = 59; // Make converse pluggable
|
|
|
+pluggable_js_dist_pluggable__WEBPACK_IMPORTED_MODULE_8___default.a.enable(_converse, '_converse', 'pluggable'); // Core plugins are whitelisted automatically
|
|
|
+// These are just the @converse/headless plugins, for the full converse,
|
|
|
+// the other plugins are whitelisted in src/converse.js
|
|
|
|
|
|
-pluggable_js_dist_pluggable__WEBPACK_IMPORTED_MODULE_8___default.a.enable(_converse, '_converse', 'pluggable');
|
|
|
+_converse.core_plugins = ['converse-chatboxes', 'converse-core', 'converse-disco', 'converse-mam', 'converse-muc', 'converse-ping', 'converse-roster', 'converse-vcard'];
|
|
|
_converse.keycodes = {
|
|
|
TAB: 9,
|
|
|
ENTER: 13,
|
|
@@ -62769,38 +62771,155 @@ _converse.isSingleton = function () {
|
|
|
|
|
|
_converse.router = new Backbone.Router();
|
|
|
|
|
|
-_converse.initialize = function (settings, callback) {
|
|
|
- settings = !_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.isUndefined(settings) ? settings : {};
|
|
|
- const init_promise = _converse_headless_utils_core__WEBPACK_IMPORTED_MODULE_11__["default"].getResolveablePromise();
|
|
|
+function initPlugins() {
|
|
|
+ // If initialize gets called a second time (e.g. during tests), then we
|
|
|
+ // need to re-apply all plugins (for a new converse instance), and we
|
|
|
+ // therefore need to clear this array that prevents plugins from being
|
|
|
+ // initialized twice.
|
|
|
+ // If initialize is called for the first time, then this array is empty
|
|
|
+ // in any case.
|
|
|
+ _converse.pluggable.initialized_plugins = [];
|
|
|
+
|
|
|
+ const whitelist = _converse.core_plugins.concat(_converse.whitelisted_plugins);
|
|
|
+
|
|
|
+ if (_converse.view_mode === 'embedded') {
|
|
|
+ _lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.forEach([// eslint-disable-line lodash/prefer-map
|
|
|
+ "converse-bookmarks", "converse-controlbox", "converse-headline", "converse-register"], name => {
|
|
|
+ _converse.blacklisted_plugins.push(name);
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
- _lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.each(PROMISES, addPromise);
|
|
|
+ _converse.pluggable.initializePlugins({
|
|
|
+ 'updateSettings'() {
|
|
|
+ _converse.log("(DEPRECATION) " + "The `updateSettings` method has been deprecated. " + "Please use `_converse.api.settings.update` instead.", strophe_js__WEBPACK_IMPORTED_MODULE_0__["Strophe"].LogLevel.WARN);
|
|
|
|
|
|
- if (!_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.isUndefined(_converse.connection)) {
|
|
|
- // Looks like _converse.initialized was called again without logging
|
|
|
- // out or disconnecting in the previous session.
|
|
|
- // This happens in tests. We therefore first clean up.
|
|
|
- Backbone.history.stop();
|
|
|
+ _converse.api.settings.update.apply(_converse, arguments);
|
|
|
+ },
|
|
|
+
|
|
|
+ '_converse': _converse
|
|
|
+ }, whitelist, _converse.blacklisted_plugins);
|
|
|
+
|
|
|
+ _converse.emit('pluginsInitialized');
|
|
|
+}
|
|
|
+
|
|
|
+function initClientConfig() {
|
|
|
+ /* The client config refers to configuration of the client which is
|
|
|
+ * independent of any particular user.
|
|
|
+ * What this means is that config values need to persist across
|
|
|
+ * user sessions.
|
|
|
+ */
|
|
|
+ const id = b64_sha1('converse.client-config');
|
|
|
+ _converse.config = new Backbone.Model({
|
|
|
+ 'id': id,
|
|
|
+ 'trusted': _converse.trusted && true || false,
|
|
|
+ 'storage': _converse.trusted ? 'local' : 'session'
|
|
|
+ });
|
|
|
+ _converse.config.browserStorage = new Backbone.BrowserStorage.session(id);
|
|
|
|
|
|
- _converse.chatboxviews.closeAllChatBoxes();
|
|
|
+ _converse.config.fetch();
|
|
|
|
|
|
- if (_converse.bookmarks) {
|
|
|
- _converse.bookmarks.reset();
|
|
|
+ _converse.emit('clientConfigInitialized');
|
|
|
+}
|
|
|
+
|
|
|
+_converse.initConnection = function () {
|
|
|
+ /* Creates a new Strophe.Connection instance if we don't already have one.
|
|
|
+ */
|
|
|
+ if (!_converse.connection) {
|
|
|
+ if (!_converse.bosh_service_url && !_converse.websocket_url) {
|
|
|
+ throw new Error("initConnection: you must supply a value for either the bosh_service_url or websocket_url or both.");
|
|
|
}
|
|
|
|
|
|
- delete _converse.controlboxtoggle;
|
|
|
- delete _converse.chatboxviews;
|
|
|
+ if (('WebSocket' in window || 'MozWebSocket' in window) && _converse.websocket_url) {
|
|
|
+ _converse.connection = new strophe_js__WEBPACK_IMPORTED_MODULE_0__["Strophe"].Connection(_converse.websocket_url, _converse.connection_options);
|
|
|
+ } else if (_converse.bosh_service_url) {
|
|
|
+ _converse.connection = new strophe_js__WEBPACK_IMPORTED_MODULE_0__["Strophe"].Connection(_converse.bosh_service_url, _lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.assignIn(_converse.connection_options, {
|
|
|
+ 'keepalive': _converse.keepalive
|
|
|
+ }));
|
|
|
+ } else {
|
|
|
+ throw new Error("initConnection: this browser does not support websockets and bosh_service_url wasn't specified.");
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- _converse.connection.reset();
|
|
|
+ _converse.emit('connectionInitialized');
|
|
|
+};
|
|
|
|
|
|
- _converse.stopListening();
|
|
|
+function setUpXMLLogging() {
|
|
|
+ strophe_js__WEBPACK_IMPORTED_MODULE_0__["Strophe"].log = function (level, msg) {
|
|
|
+ _converse.log(msg, level);
|
|
|
+ };
|
|
|
|
|
|
- _converse.tearDown();
|
|
|
+ if (_converse.debug) {
|
|
|
+ _converse.connection.xmlInput = function (body) {
|
|
|
+ _converse.log(body.outerHTML, strophe_js__WEBPACK_IMPORTED_MODULE_0__["Strophe"].LogLevel.DEBUG, 'color: darkgoldenrod');
|
|
|
+ };
|
|
|
+
|
|
|
+ _converse.connection.xmlOutput = function (body) {
|
|
|
+ _converse.log(body.outerHTML, strophe_js__WEBPACK_IMPORTED_MODULE_0__["Strophe"].LogLevel.DEBUG, 'color: darkcyan');
|
|
|
+ };
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function finishInitialization() {
|
|
|
+ initPlugins();
|
|
|
+ initClientConfig();
|
|
|
+
|
|
|
+ _converse.initConnection();
|
|
|
+
|
|
|
+ setUpXMLLogging();
|
|
|
+
|
|
|
+ _converse.logIn();
|
|
|
+
|
|
|
+ _converse.registerGlobalEventHandlers();
|
|
|
+
|
|
|
+ if (!Backbone.history.started) {
|
|
|
+ Backbone.history.start();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (_converse.idle_presence_timeout > 0) {
|
|
|
+ _converse.on('addClientFeatures', () => {
|
|
|
+ _converse.api.disco.own.features.add(strophe_js__WEBPACK_IMPORTED_MODULE_0__["Strophe"].NS.IDLE);
|
|
|
+ });
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function cleanup() {
|
|
|
+ // Looks like _converse.initialized was called again without logging
|
|
|
+ // out or disconnecting in the previous session.
|
|
|
+ // This happens in tests. We therefore first clean up.
|
|
|
+ Backbone.history.stop();
|
|
|
+
|
|
|
+ _converse.chatboxviews.closeAllChatBoxes();
|
|
|
+
|
|
|
+ window.localStorage.clear();
|
|
|
+ window.sessionStorage.clear();
|
|
|
+
|
|
|
+ if (_converse.bookmarks) {
|
|
|
+ _converse.bookmarks.reset();
|
|
|
+ }
|
|
|
+
|
|
|
+ delete _converse.controlboxtoggle;
|
|
|
+ delete _converse.chatboxviews;
|
|
|
|
|
|
- delete _converse.config;
|
|
|
+ _converse.connection.reset();
|
|
|
|
|
|
- _converse.initClientConfig();
|
|
|
+ _converse.stopListening();
|
|
|
|
|
|
- _converse.off();
|
|
|
+ _converse.tearDown();
|
|
|
+
|
|
|
+ delete _converse.config;
|
|
|
+ initClientConfig();
|
|
|
+
|
|
|
+ _converse.off();
|
|
|
+}
|
|
|
+
|
|
|
+_converse.initialize = function (settings, callback) {
|
|
|
+ settings = !_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.isUndefined(settings) ? settings : {};
|
|
|
+ const init_promise = _converse_headless_utils_core__WEBPACK_IMPORTED_MODULE_11__["default"].getResolveablePromise();
|
|
|
+
|
|
|
+ _lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.each(PROMISES, addPromise);
|
|
|
+
|
|
|
+ if (!_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.isUndefined(_converse.connection)) {
|
|
|
+ cleanup();
|
|
|
}
|
|
|
|
|
|
if ('onpagehide' in window) {
|
|
@@ -63169,29 +63288,10 @@ _converse.initialize = function (settings, callback) {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- this.initClientConfig = function () {
|
|
|
- /* The client config refers to configuration of the client which is
|
|
|
- * independent of any particular user.
|
|
|
- * What this means is that config values need to persist across
|
|
|
- * user sessions.
|
|
|
- */
|
|
|
- const id = b64_sha1('converse.client-config');
|
|
|
- _converse.config = new Backbone.Model({
|
|
|
- 'id': id,
|
|
|
- 'trusted': _converse.trusted && true || false,
|
|
|
- 'storage': _converse.trusted ? 'local' : 'session'
|
|
|
- });
|
|
|
- _converse.config.browserStorage = new Backbone.BrowserStorage.session(id);
|
|
|
-
|
|
|
- _converse.config.fetch();
|
|
|
-
|
|
|
- _converse.emit('clientConfigInitialized');
|
|
|
- };
|
|
|
-
|
|
|
this.initSession = function () {
|
|
|
const id = b64_sha1('converse.bosh-session');
|
|
|
_converse.session = new Backbone.Model({
|
|
|
- 'id': id
|
|
|
+ id
|
|
|
});
|
|
|
_converse.session.browserStorage = new Backbone.BrowserStorage.session(id);
|
|
|
|
|
@@ -63456,22 +63556,6 @@ _converse.initialize = function (settings, callback) {
|
|
|
|
|
|
});
|
|
|
|
|
|
- this.setUpXMLLogging = function () {
|
|
|
- strophe_js__WEBPACK_IMPORTED_MODULE_0__["Strophe"].log = function (level, msg) {
|
|
|
- _converse.log(msg, level);
|
|
|
- };
|
|
|
-
|
|
|
- if (this.debug) {
|
|
|
- this.connection.xmlInput = function (body) {
|
|
|
- _converse.log(body.outerHTML, strophe_js__WEBPACK_IMPORTED_MODULE_0__["Strophe"].LogLevel.DEBUG, 'color: darkgoldenrod');
|
|
|
- };
|
|
|
-
|
|
|
- this.connection.xmlOutput = function (body) {
|
|
|
- _converse.log(body.outerHTML, strophe_js__WEBPACK_IMPORTED_MODULE_0__["Strophe"].LogLevel.DEBUG, 'color: darkcyan');
|
|
|
- };
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
this.fetchLoginCredentials = () => new es6_promise_dist_es6_promise_auto__WEBPACK_IMPORTED_MODULE_3___default.a((resolve, reject) => {
|
|
|
const xhr = new XMLHttpRequest();
|
|
|
xhr.open('GET', _converse.credentials_url, true);
|
|
@@ -63656,28 +63740,6 @@ _converse.initialize = function (settings, callback) {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- this.initConnection = function () {
|
|
|
- /* Creates a new Strophe.Connection instance if we don't already have one.
|
|
|
- */
|
|
|
- if (!this.connection) {
|
|
|
- if (!this.bosh_service_url && !this.websocket_url) {
|
|
|
- throw new Error("initConnection: you must supply a value for either the bosh_service_url or websocket_url or both.");
|
|
|
- }
|
|
|
-
|
|
|
- if (('WebSocket' in window || 'MozWebSocket' in window) && this.websocket_url) {
|
|
|
- this.connection = new strophe_js__WEBPACK_IMPORTED_MODULE_0__["Strophe"].Connection(this.websocket_url, this.connection_options);
|
|
|
- } else if (this.bosh_service_url) {
|
|
|
- this.connection = new strophe_js__WEBPACK_IMPORTED_MODULE_0__["Strophe"].Connection(this.bosh_service_url, _lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.assignIn(this.connection_options, {
|
|
|
- 'keepalive': this.keepalive
|
|
|
- }));
|
|
|
- } else {
|
|
|
- throw new Error("initConnection: this browser does not support websockets and bosh_service_url wasn't specified.");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- _converse.emit('connectionInitialized');
|
|
|
- };
|
|
|
-
|
|
|
this.tearDown = function () {
|
|
|
/* Remove those views which are only allowed with a valid
|
|
|
* connection.
|
|
@@ -63698,37 +63760,6 @@ _converse.initialize = function (settings, callback) {
|
|
|
_converse.emit('afterTearDown');
|
|
|
|
|
|
return _converse;
|
|
|
- };
|
|
|
-
|
|
|
- this.initPlugins = function () {
|
|
|
- // If initialize gets called a second time (e.g. during tests), then we
|
|
|
- // need to re-apply all plugins (for a new converse instance), and we
|
|
|
- // therefore need to clear this array that prevents plugins from being
|
|
|
- // initialized twice.
|
|
|
- // If initialize is called for the first time, then this array is empty
|
|
|
- // in any case.
|
|
|
- _converse.pluggable.initialized_plugins = [];
|
|
|
-
|
|
|
- const whitelist = _converse.core_plugins.concat(_converse.whitelisted_plugins);
|
|
|
-
|
|
|
- if (_converse.view_mode === 'embedded') {
|
|
|
- _lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.forEach([// eslint-disable-line lodash/prefer-map
|
|
|
- "converse-bookmarks", "converse-controlbox", "converse-headline", "converse-register"], name => {
|
|
|
- _converse.blacklisted_plugins.push(name);
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- _converse.pluggable.initializePlugins({
|
|
|
- 'updateSettings'() {
|
|
|
- _converse.log("(DEPRECATION) " + "The `updateSettings` method has been deprecated. " + "Please use `_converse.api.settings.update` instead.", strophe_js__WEBPACK_IMPORTED_MODULE_0__["Strophe"].LogLevel.WARN);
|
|
|
-
|
|
|
- _converse.api.settings.update.apply(_converse, arguments);
|
|
|
- },
|
|
|
-
|
|
|
- '_converse': _converse
|
|
|
- }, whitelist, _converse.blacklisted_plugins);
|
|
|
-
|
|
|
- _converse.emit('pluginsInitialized');
|
|
|
}; // Initialization
|
|
|
// --------------
|
|
|
// This is the end of the initialize method.
|
|
@@ -63738,30 +63769,6 @@ _converse.initialize = function (settings, callback) {
|
|
|
this.connection = settings.connection;
|
|
|
}
|
|
|
|
|
|
- function finishInitialization() {
|
|
|
- _converse.initPlugins();
|
|
|
-
|
|
|
- _converse.initClientConfig();
|
|
|
-
|
|
|
- _converse.initConnection();
|
|
|
-
|
|
|
- _converse.setUpXMLLogging();
|
|
|
-
|
|
|
- _converse.logIn();
|
|
|
-
|
|
|
- _converse.registerGlobalEventHandlers();
|
|
|
-
|
|
|
- if (!Backbone.history.started) {
|
|
|
- Backbone.history.start();
|
|
|
- }
|
|
|
-
|
|
|
- if (_converse.idle_presence_timeout > 0) {
|
|
|
- _converse.on('addClientFeatures', () => {
|
|
|
- _converse.api.disco.own.features.add(strophe_js__WEBPACK_IMPORTED_MODULE_0__["Strophe"].NS.IDLE);
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
if (!_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.isUndefined(_converse.connection) && _converse.connection.service === 'jasmine tests') {
|
|
|
finishInitialization();
|
|
|
return _converse;
|