[polari] app: Only save channels after connecting successfully



commit 6d8a286d8869f979a19417bd4a67ec7b5733077f
Author: Florian Müllner <fmuellner gnome org>
Date:   Sun Oct 6 20:03:55 2013 +0200

    app: Only save channels after connecting successfully
    
    Connection failures may be either temporary (for instance when the
    requested network is currently unavailable) or permanent (as in case
    of configuration errors). Currently when saving channels, we sill still
    try to remember the latter and try to (unsuccessfully) connect to them
    each time we are started.
    While we could try to disentangle the two classes of errors, only
    saving channels on successful connection will take care of not ending
    up with saved channels that are impossible to connect to, without
    too bad drawbacks.

 src/application.js |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index 089884a..661a597 100644
--- a/src/application.js
+++ b/src/application.js
@@ -307,6 +307,9 @@ const Application = new Lang.Class({
 
         try {
             req.ensure_channel_finish(res);
+
+            if (requestData.targetHandleType == Tp.HandleType.ROOM)
+                this._addSavedChannel(account, requestData.targetId);
         } catch (e if e.matches(Tp.Error, Tp.Error.DISCONNECTED)) {
             let [error,] = account.dup_detailed_error_vardict();
             if (error != TP_ERROR_ALREADY_CONNECTED)
@@ -332,8 +335,6 @@ const Application = new Lang.Class({
 
         if (requestData.retry > 0)
             this._updateAccountName(account, requestData.originalNick, null);
-        if (requestData.targetHandleType == Tp.HandleType.ROOM)
-            this._addSavedChannel(account, requestData.targetId);
     },
 
     _onJoinRoom: function(action, parameter) {


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