[polari/gnome-3-24] telepathyClient: Don't conflate network- with account changes



commit f308317501c402edac48ebe5fb1d285bd8cac159
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 8b98169..0144853 100644
--- a/src/telepathyClient.js
+++ b/src/telepathyClient.js
@@ -194,6 +194,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));
@@ -208,11 +211,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]