[ekiga] Fix removed signal triggering



commit ba29e21135319fb2c8d7968ffa9cce9bc7cb982e
Author: Eugen Dedu <eugen dedu univ-fcomte fr>
Date:   Mon Nov 30 14:31:37 2015 +0100

    Fix removed signal triggering
    
    Currently, remove_object () from dynamic-object-store.h was called first,
    and the other slots were not called anymore.  As a result, Ekiga did not
    unsubscribe from presence of removed contacts for example.

 lib/engine/components/opal/opal-account.cpp |   66 +++++++++++----------------
 lib/engine/components/opal/opal-bank.cpp    |   27 ++++++-----
 2 files changed, 40 insertions(+), 53 deletions(-)
---
diff --git a/lib/engine/components/opal/opal-account.cpp b/lib/engine/components/opal/opal-account.cpp
index d0ca532..7d21d86 100644
--- a/lib/engine/components/opal/opal-account.cpp
+++ b/lib/engine/components/opal/opal-account.cpp
@@ -92,22 +92,19 @@ Opal::Account::build_node(Opal::Account::Type typus,
   xmlNodePtr node = xmlNewNode (NULL, BAD_CAST "account");
 
   xmlNewChild (node, NULL, BAD_CAST "name",
-              BAD_CAST robust_xmlEscape (node->doc, name).c_str ());
+               BAD_CAST robust_xmlEscape (node->doc, name).c_str ());
   xmlNewChild (node, NULL, BAD_CAST "host",
-              BAD_CAST robust_xmlEscape (node->doc, host).c_str ());
+               BAD_CAST robust_xmlEscape (node->doc, host).c_str ());
   xmlNewChild (node, NULL, BAD_CAST "user",
-              BAD_CAST robust_xmlEscape (node->doc, user).c_str ());
+               BAD_CAST robust_xmlEscape (node->doc, user).c_str ());
   xmlNewChild (node, NULL, BAD_CAST "auth_user",
-              BAD_CAST robust_xmlEscape (node->doc, auth_user).c_str ());
+               BAD_CAST robust_xmlEscape (node->doc, auth_user).c_str ());
   xmlNewChild (node, NULL, BAD_CAST "password",
-              BAD_CAST robust_xmlEscape (node->doc, password).c_str ());
-  if (enabled) {
-
+               BAD_CAST robust_xmlEscape (node->doc, password).c_str ());
+  if (enabled)
     xmlSetProp (node, BAD_CAST "enabled", BAD_CAST "true");
-  } else {
-
+  else
     xmlSetProp (node, BAD_CAST "enabled", BAD_CAST "false");
-  }
   {
     std::stringstream sstream;
     sstream << timeout;
@@ -522,18 +519,12 @@ Opal::Account::set_authentication_settings (const std::string& username,
 
     if (child->type == XML_ELEMENT_NODE && child->name != NULL) {
 
-      if (xmlStrEqual (BAD_CAST "user", child->name)) {
-
+      if (xmlStrEqual (BAD_CAST "user", child->name))
         robust_xmlNodeSetContent (node, &child, "user", username);
-      }
-      if (xmlStrEqual (BAD_CAST "auth_user", child->name)) {
-
+      if (xmlStrEqual (BAD_CAST "auth_user", child->name))
         robust_xmlNodeSetContent (node, &child, "auth_user", username);
-      }
-      if (xmlStrEqual (BAD_CAST "password", child->name)) {
-
+      if (xmlStrEqual (BAD_CAST "password", child->name))
         robust_xmlNodeSetContent (node, &child, "password", password);
-      }
     }
   }
 
@@ -603,9 +594,8 @@ Opal::Account::disable ()
         (*iter)->set_status ("");
       }
 
-      if (type != Account::H323 && sip_endpoint) {
+      if (type != Account::H323 && sip_endpoint)
         sip_endpoint->Unsubscribe (SIPSubscribe::MessageSummary, get_full_uri (get_aor ()));
-      }
 
       opal_presentity->Close ();
     }
@@ -636,13 +626,10 @@ Opal::Account::is_enabled () const
 
   if (xml_str != NULL) {
 
-    if (xmlStrEqual (xml_str, BAD_CAST "true")) {
-
+    if (xmlStrEqual (xml_str, BAD_CAST "true"))
       result = true;
-    } else {
-
+    else
       result = false;
-    }
     xmlFree (xml_str);
   }
 
@@ -864,19 +851,18 @@ Opal::Account::on_edit_form_submitted (bool submitted,
 
       if (child->type == XML_ELEMENT_NODE && child->name != NULL) {
 
-
-       if (xmlStrEqual (BAD_CAST "name", child->name))
-         robust_xmlNodeSetContent (node, &child, "name", new_name);
-       if (xmlStrEqual (BAD_CAST "host", child->name))
-         robust_xmlNodeSetContent (node, &child, "host", new_host);
-       if (xmlStrEqual (BAD_CAST "outbound_proxy", child->name))
-         robust_xmlNodeSetContent (node, &child, "outbound_proxy", new_outbound_proxy);
-       if (xmlStrEqual (BAD_CAST "user", child->name))
-         robust_xmlNodeSetContent (node, &child, "user", new_user);
-       if (xmlStrEqual (BAD_CAST "auth_user", child->name))
-         robust_xmlNodeSetContent (node, &child, "auth_user", new_authentication_user);
-       if (xmlStrEqual (BAD_CAST "password", child->name))
-         robust_xmlNodeSetContent (node, &child, "password", new_password);
+        if (xmlStrEqual (BAD_CAST "name", child->name))
+          robust_xmlNodeSetContent (node, &child, "name", new_name);
+        if (xmlStrEqual (BAD_CAST "host", child->name))
+          robust_xmlNodeSetContent (node, &child, "host", new_host);
+        if (xmlStrEqual (BAD_CAST "outbound_proxy", child->name))
+          robust_xmlNodeSetContent (node, &child, "outbound_proxy", new_outbound_proxy);
+        if (xmlStrEqual (BAD_CAST "user", child->name))
+          robust_xmlNodeSetContent (node, &child, "user", new_user);
+        if (xmlStrEqual (BAD_CAST "auth_user", child->name))
+          robust_xmlNodeSetContent (node, &child, "auth_user", new_authentication_user);
+        if (xmlStrEqual (BAD_CAST "password", child->name))
+          robust_xmlNodeSetContent (node, &child, "password", new_password);
       }
     }
 
@@ -986,7 +972,7 @@ Opal::Account::load_presentity (boost::weak_ptr<Ekiga::PresenceCore> _presence_c
   // When the presentity emits trigger_saving, we relay it "upstream" so that the
   // Bank can save everything.
   presentities.add_connection (pres, pres->trigger_saving.connect (boost::ref (trigger_saving)));
-  presentities.add_connection (pres, pres->removed.connect (boost::bind (&Opal::Account::unfetch, this, 
pres->get_uri ())));
+  presentities.add_connection (pres, pres->removed.connect (boost::bind (&Opal::Account::unfetch, this, 
pres->get_uri ()), boost::signals2::at_front));
   presentities.add_connection (pres, pres->updated.connect (boost::bind (&Opal::Account::fetch, this, 
pres->get_uri ())));
   add_presentity (pres);
 
diff --git a/lib/engine/components/opal/opal-bank.cpp b/lib/engine/components/opal/opal-bank.cpp
index e9161e8..deb41be 100644
--- a/lib/engine/components/opal/opal-bank.cpp
+++ b/lib/engine/components/opal/opal-bank.cpp
@@ -100,21 +100,22 @@ boost::shared_ptr<Opal::Account>
 Opal::Bank::load_account (boost::function0<std::list<std::string> > _existing_groups,
                           xmlNodePtr _node)
 {
-  boost::shared_ptr<Opal::Account> account = Opal::Account::create (*this,
-                                                                    presence_core,
-                                                                    notification_core,
-                                                                    personal_details,
-                                                                    audiooutput_core,
-                                                                    endpoint,
+  boost::shared_ptr<Opal::Account> account =
+    Opal::Account::create (*this,
+                           presence_core,
+                           notification_core,
+                           personal_details,
+                           audiooutput_core,
+                           endpoint,
 #ifdef HAVE_H323
-                                                                    h323_endpoint,
+                           h323_endpoint,
 #endif
-                                                                    sip_endpoint,
-                                                                    _existing_groups,
-                                                                    _node);
+                           sip_endpoint,
+                           _existing_groups,
+                           _node);
 
   accounts.add_connection (account, account->trigger_saving.connect (boost::bind (&Opal::Bank::save, this)));
-  accounts.add_connection (account, account->removed.connect (boost::bind (&Opal::Bank::on_account_removed, 
this, _1)));
+  accounts.add_connection (account, account->removed.connect (boost::bind (&Opal::Bank::on_account_removed, 
this, _1), boost::signals2::at_front));
 
   add_account (account);
   add_heap (account);
@@ -247,9 +248,9 @@ Opal::Bank::on_new_account_form_submitted (bool submitted,
   boost::shared_ptr<Ekiga::FormRequestSimple> request = boost::shared_ptr<Ekiga::FormRequestSimple> (new 
Ekiga::FormRequestSimple (boost::bind (&Opal::Bank::on_new_account_form_submitted, this, _1, _2, _3, 
acc_type)));
 
   std::string new_name = (acc_type == Opal::Account::SIP
-                         || acc_type == Opal::Account::H323) ? result.text ("name") : result.hidden ("name");
+                          || acc_type == Opal::Account::H323) ? result.text ("name") : result.hidden 
("name");
   std::string new_host = (acc_type == Opal::Account::SIP
-                         || acc_type == Opal::Account::H323) ? result.text ("host") : result.hidden ("host");
+                          || acc_type == Opal::Account::H323) ? result.text ("host") : result.hidden 
("host");
   std::string new_user = result.text ("user");
   std::string new_authentication_user = (acc_type == Opal::Account::SIP && ! result.text 
("authentication_user").empty ()) ? result.text ("authentication_user") : new_user;
   std::string new_password = result.text ("password");


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