Bug 842183 - Land in comm-central Instantbird's changes to chat/ - 5 - Bio 1846 - follow-up to fix reconnection timers, r=fqueze.
authoraleth <aleth@instantbird.org>
Sat, 15 Dec 2012 00:05:21 +0100
changeset 14899 148c0dea391a2876962e4f061b8fe62863cd13d4
parent 14898 ed456f650deb69c0aa6eaf12ce659467e590edf0
child 14900 fc12e25962d57bbe3ecf995fd054daca0238040f
push id867
push userbugzilla@standard8.plus.com
push dateMon, 01 Apr 2013 20:44:27 +0000
treeherdercomm-beta@797726b8d244 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfqueze
bugs842183
Bug 842183 - Land in comm-central Instantbird's changes to chat/ - 5 - Bio 1846 - follow-up to fix reconnection timers, r=fqueze.
chat/components/src/imAccounts.js
--- a/chat/components/src/imAccounts.js
+++ b/chat/components/src/imAccounts.js
@@ -244,16 +244,17 @@ imAccount.prototype = {
             connectionErrorReason == Ci.prplIAccount.ERROR_ENCRYPTION_ERROR)
           this._startReconnectTimer();
         this._sendNotification("account-connect-error");
       }
     }
     else if (aTopic == "account-disconnected") {
       this.connectionState = Ci.imIAccount.STATE_DISCONNECTED;
       if (this._statusObserver &&
+          this.prplAccount.connectionErrorReason == Ci.prplIAccount.NO_ERROR &&
           this.statusInfo.statusType > Ci.imIStatusInfo.STATUS_OFFLINE) {
         // If the status changed back to online while an account was still
         // disconnecting, it was not reconnected automatically at that point,
         // so we must do it now. (This happens for protocols like IRC where
         // disconnection is not immediate.)
         this._sendNotification(aTopic, aData);
         this.connect();
         return;
@@ -623,17 +624,18 @@ imAccount.prototype = {
           // the prplAccount instance.
           let statusType = aSubject.statusType;
           if (statusType == Ci.imIStatusInfo.STATUS_OFFLINE) {
             if (this.connected || this.connecting)
               this.prplAccount.disconnect();
             this._cancelReconnection();
           }
           else if (statusType > Ci.imIStatusInfo.STATUS_OFFLINE &&
-                   this.disconnected)
+                   this.disconnected &&
+                   this.connectionErrorReason == Ci.prplIAccount.NO_ERROR)
             this.prplAccount.connect();
           else if (this.connected)
             this.prplAccount.observe(aSubject, aTopic, aData);
         }).bind(this)
       };
 
       this.statusInfo.addObserver(this._statusObserver);
     }