From d527f693c22b3eded8c638004f85901eac775b7f Mon Sep 17 00:00:00 2001 From: JC Brand Date: Thu, 15 Jun 2017 17:21:57 +0200 Subject: [PATCH] Updates #890 Destroy and recreate session upon reconnection This ensures that carbons will be activated again. --- .gitignore | 1 + CHANGES.md | 1 + src/converse-controlbox.js | 4 ++-- src/converse-core.js | 4 ++-- src/converse-muc.js | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 7a585cf31..c2bee44c8 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,7 @@ eggs dev-jc.html inverse-dev.html +inverse-dev-jc.html converse-logs/*.html diff --git a/CHANGES.md b/CHANGES.md index a38f3c21a..c56469a4b 100755 --- a/CHANGES.md +++ b/CHANGES.md @@ -22,6 +22,7 @@ - #754 Show unread messages next to roster contacts. [jcbrand] - #864 Remove all inline CSS to comply with strict Content-Security-Policy headers [mathiasertl] - #873 Inconsistent unread messages count updating [novokrest] +- #890 Message carbons not sent out after reconnection [jcbrand] - #894 Room affiliation lost when connection jid and room presence jid are of different case [Rayzen] ## 3.0.2 (2017-04-23) diff --git a/src/converse-controlbox.js b/src/converse-controlbox.js index 4b266ae6f..656ee1ad4 100644 --- a/src/converse-controlbox.js +++ b/src/converse-controlbox.js @@ -64,9 +64,9 @@ // // New functions which don't exist yet can also be added. - initSession: function () { + initChatBoxes: function () { + this.__super__.initChatBoxes.apply(this, arguments); this.controlboxtoggle = new this.ControlBoxToggle(); - this.__super__.initSession.apply(this, arguments); }, initConnection: function () { diff --git a/src/converse-core.js b/src/converse-core.js index 957fa92a6..cb2240037 100755 --- a/src/converse-core.js +++ b/src/converse-core.js @@ -571,7 +571,6 @@ if (!_.isUndefined(this.roster)) { this.roster.browserStorage._clear(); } - this.session.browserStorage._clear(); }; this.logOut = function () { @@ -755,6 +754,7 @@ // by browser. _converse.connection.flush(); + _converse.initSession(); _converse.setUserJid(); _converse.enableCarbons(); @@ -2090,6 +2090,7 @@ if (this.features) { this.features.reset(); } + this.session.destroy(); window.removeEventListener('click', _converse.onUserActivity); window.removeEventListener('focus', _converse.onUserActivity); window.removeEventListener('keypress', _converse.onUserActivity); @@ -2139,7 +2140,6 @@ } _converse.initPlugins(); _converse.initChatBoxes(); - _converse.initSession(); _converse.initConnection(); _converse.setUpXMLLogging(); _converse.logIn(); diff --git a/src/converse-muc.js b/src/converse-muc.js index 4ba63002e..07f9cc3b7 100755 --- a/src/converse-muc.js +++ b/src/converse-muc.js @@ -1225,7 +1225,7 @@ }, cleanup: function () { - if (this.model.collection.browserStorage) { + if (this.model.collection && this.model.collection.browserStorage) { this.model.save('connection_status', ROOMSTATUS.DISCONNECTED); } else { this.model.set('connection_status', ROOMSTATUS.DISCONNECTED);