Просмотр исходного кода

Fix for issue #648 (#649)

* Updated onDisconnected method to fire disconnected event. Issue #648

* Updated docs/CHANGES.md
Kamran 9 лет назад
Родитель
Сommit
b82e0f3136
2 измененных файлов с 7 добавлено и 7 удалено
  1. 3 2
      docs/CHANGES.md
  2. 4 5
      src/converse-core.js

+ 3 - 2
docs/CHANGES.md

@@ -2,11 +2,12 @@
 
 ## 1.0.3 (Unreleased)
 
-- Bugfix. Login form doesn't render after logging out, when `auto_reconnect = false` 
+- Bugfix. Login form doesn't render after logging out, when `auto_reconnect = false`
   [jcbrand]
 - Also indicate new day for the first day's messages. [jcbrand]
 - Chat bot messages don't appear when they have the same ids as their commands.
   [jcbrand]
+- Updated onDisconnected method to fire disconnected event even if auto_reconnect is false. [kamranzafar]
 
 ## 1.0.2 (2016-05-24)
 
@@ -318,7 +319,7 @@
 
 ## 0.7.4 (2014-03-05)
 
-**note:** 
+**note:**
 *This release contains an important security fix. Thanks to Renaud Dubourguais from [Synacktiv](http://synacktiv.com) for reporting the vulnerability.*
 
 - #125 Bugfix: crypto dependencies loaded in wrong order [jcbrand]

+ 4 - 5
src/converse-core.js

@@ -204,7 +204,7 @@
                 }
             }
         };
-		
+
         this.detectLocale = function (library_check) {
             /* Determine which locale is supported by the user's system as well
              * as by the relevant library (e.g. converse.js or moment.js).
@@ -232,7 +232,7 @@
             }
             return locale || 'en';
         };
-		
+
         if (!moment.locale) { //moment.lang is deprecated after 2.8.1, use moment.locale instead
             moment.locale = moment.lang;
         }
@@ -442,8 +442,7 @@
         }, 1000);
 
         this.onDisconnected = function (condition) {
-            if (!converse.auto_reconnect) { return 'disconnected'; }
-            if (converse.disconnection_cause === Strophe.Status.CONNFAIL) {
+            if (converse.disconnection_cause === Strophe.Status.CONNFAIL && converse.auto_reconnect) {
                 converse.reconnect(condition);
                 return 'reconnecting';
             } else {
@@ -611,7 +610,7 @@
 
 
         this.onStatusInitialized = function (deferred) {
-            this.registerIntervalHandler();				
+            this.registerIntervalHandler();
             this.roster = new this.RosterContacts();
             this.roster.browserStorage = new Backbone.BrowserStorage[this.storage](
                 b64_sha1('converse.contacts-'+this.bare_jid));