[ekiga] Accounts: Fixed various crashes related to account updates.



commit c451b8159bb03d46e513ced09934ea6f9b71f0c6
Author: Damien Sandras <dsandras beip be>
Date:   Sun Sep 30 15:10:37 2012 +0200

    Accounts: Fixed various crashes related to account updates.
    
    The algorithm is now a bit more clever. It does not
    unsubscribe/subscribe in paralle, it only trigger a registration update
    when required (and not on a simple account name change), and so on...

 lib/engine/components/opal/opal-account.cpp |   47 +++++++++++++++++++-------
 1 files changed, 34 insertions(+), 13 deletions(-)
---
diff --git a/lib/engine/components/opal/opal-account.cpp b/lib/engine/components/opal/opal-account.cpp
index d59f5a6..8361855 100644
--- a/lib/engine/components/opal/opal-account.cpp
+++ b/lib/engine/components/opal/opal-account.cpp
@@ -479,19 +479,40 @@ void Opal::Account::on_edit_form_submitted (bool submitted,
   }
   else {
 
-    disable ();
-    name = new_name;
-    host = new_host;
-    username = new_user;
-    auth_username = new_authentication_user;
-    password = new_password;
-    timeout = new_timeout;
-    enabled = new_enabled;
-    if (enabled)
-      enable ();
+    // Account was enabled and is now disabled
+    if (enabled != new_enabled && !new_enabled) {
+      enabled = new_enabled;
 
-    updated ();
-    trigger_saving ();
+      disable ();
+    }
+    // Account was disabled and is now enabled
+    // or account was already enabled
+    else if (new_enabled) {
+      // Some critical setting just changed
+      if (host != new_host || username != new_user
+          || auth_username != new_authentication_user
+          || password != new_password
+          || timeout != new_timeout
+          || enabled != new_enabled) {
+
+        name = new_name;
+        host = new_host;
+        username = new_user;
+        auth_username = new_authentication_user;
+        password = new_password;
+        timeout = new_timeout;
+        enabled = new_enabled;
+
+        enable ();
+      }
+      else {
+        name = new_name;
+        enabled = new_enabled;
+
+        updated ();
+        trigger_saving ();
+      }
+    }
   }
 }
 



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