[polari] telepathyClient: Don't conflate network- with account changes



commit a9ed3bb7e702d4975271349221b4c165df268917
Author: Florian Müllner <fmuellner gnome org>
Date:   Wed Jun 21 15:33:01 2017 +0200

    telepathyClient: Don't conflate network- with account changes
    
    On startup, we need to pick up both the initial network status
    as well as the account status (so we identify the user and
    connect rooms when the account is already connected, for
    example when restarted after a crash). We currently cover
    both cases when handling changes to the network availability,
    however as we are about to monitor more network changes, we
    may end up reinitializing accounts that are already connected.
    While that shouldn't break anything, we can avoid the unnecessary
    work by handling network- and account status initialization
    separately.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=784047

 src/telepathyClient.js |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/src/telepathyClient.js b/src/telepathyClient.js
index 3870782..33f8a0f 100644
--- a/src/telepathyClient.js
+++ b/src/telepathyClient.js
@@ -193,6 +193,9 @@ const TelepathyClient = new Lang.Class({
         this._accountsMonitor.connect('account-enabled', (mon, account) => {
             this._connectAccount(account);
         });
+        this._accountsMonitor.enabledAccounts.forEach(a => {
+            this._onAccountStatusChanged(this._accountsMonitor, a);
+        });
 
         this._networkMonitor.connect('notify::network-available',
                                      Lang.bind(this, this._onNetworkAvailableChanged));
@@ -207,11 +210,7 @@ const TelepathyClient = new Lang.Class({
                                                        : 'unavailable'));
 
         this._accountsMonitor.enabledAccounts.forEach(a => {
-            if (a.requested_presence_type == Tp.ConnectionPresenceType.AVAILABLE &&
-                a.connection_status == Tp.ConnectionStatus.CONNECTED)
-                this._onAccountStatusChanged(this._accountsMonitor, a);
-            else
-                this._setAccountPresence(a, presence);
+            this._setAccountPresence(a, presence);
         });
     },
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]