Browse Source

Updates #890 Destroy and recreate session upon reconnection

This ensures that carbons will be activated again.
JC Brand 8 years ago
parent
commit
d527f693c2
5 changed files with 7 additions and 5 deletions
  1. 1 0
      .gitignore
  2. 1 0
      CHANGES.md
  3. 2 2
      src/converse-controlbox.js
  4. 2 2
      src/converse-core.js
  5. 1 1
      src/converse-muc.js

+ 1 - 0
.gitignore

@@ -16,6 +16,7 @@ eggs
 
 dev-jc.html
 inverse-dev.html
+inverse-dev-jc.html
 
 converse-logs/*.html
 

+ 1 - 0
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)

+ 2 - 2
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 () {

+ 2 - 2
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();

+ 1 - 1
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);