浏览代码

Don't try to reconnect on auth fail.

JC Brand 9 年之前
父节点
当前提交
a969d010cb
共有 2 个文件被更改,包括 10 次插入8 次删除
  1. 7 0
      docs/source/development.rst
  2. 3 8
      src/converse-core.js

+ 7 - 0
docs/source/development.rst

@@ -873,6 +873,13 @@ When a chat buddy's custom status message has changed.
 
 
 ``converse.listen.on('contactStatusMessageChanged', function (event, data) { ... });``
 ``converse.listen.on('contactStatusMessageChanged', function (event, data) { ... });``
 
 
+disconnected
+~~~~~~~~~~~~
+
+After converse.js has disconnected from the XMPP server.
+
+``converse.listen.on('disconnected', function (event) { ... });``
+
 initialized
 initialized
 ~~~~~~~~~~~
 ~~~~~~~~~~~
 
 

+ 3 - 8
src/converse-core.js

@@ -440,15 +440,11 @@
 
 
         this.onDisconnected = function (condition) {
         this.onDisconnected = function (condition) {
             if (!converse.auto_reconnect) { return; }
             if (!converse.auto_reconnect) { return; }
-            if (converse.disconnection_cause === Strophe.Status.CONNFAIL ||
-                    (converse.disconnection_cause === Strophe.Status.AUTHFAIL &&
-                     converse.credentials_url &&
-                     !converse.logged_out
-                    )
-                ) {
+            if (converse.disconnection_cause === Strophe.Status.CONNFAIL) {
                 converse.reconnect(condition);
                 converse.reconnect(condition);
                 return 'reconnecting';
                 return 'reconnecting';
             } else {
             } else {
+                converse.emit('disconnected');
                 return 'disconnected';
                 return 'disconnected';
             }
             }
         };
         };
@@ -551,7 +547,6 @@
         };
         };
 
 
         this.logOut = function () {
         this.logOut = function () {
-            converse.auto_login = false;
             converse.chatboxviews.closeAllChatBoxes();
             converse.chatboxviews.closeAllChatBoxes();
             converse.clearSession();
             converse.clearSession();
             if (typeof converse.connection !== 'undefined') {
             if (typeof converse.connection !== 'undefined') {
@@ -1650,7 +1645,7 @@
 
 
         this.autoLogin = function (credentials) {
         this.autoLogin = function (credentials) {
             if (credentials) {
             if (credentials) {
-                // If passed in, then they come from login_credentials, so we
+                // If passed in, then they come from credentials_url, so we
                 // set them on the converse object.
                 // set them on the converse object.
                 this.jid = credentials.jid;
                 this.jid = credentials.jid;
                 this.password = credentials.password;
                 this.password = credentials.password;