[ekiga] Fix error message when adding a contact with an unsupported address



commit c5c2643db9c61a0ed0a9263e5656b42def30e0f9
Author: Eugen Dedu <eugen dedu univ-fcomte fr>
Date:   Mon Jul 27 20:51:01 2015 +0200

    Fix error message when adding a contact with an unsupported address

 lib/engine/components/opal/opal-account.cpp |   37 +++++++++++---------------
 1 files changed, 16 insertions(+), 21 deletions(-)
---
diff --git a/lib/engine/components/opal/opal-account.cpp b/lib/engine/components/opal/opal-account.cpp
index f42dc81..2688e13 100644
--- a/lib/engine/components/opal/opal-account.cpp
+++ b/lib/engine/components/opal/opal-account.cpp
@@ -897,30 +897,25 @@ Opal::Account::on_add_contact_form_submitted (bool submitted,
   uri = result.text ("uri");
   uri = canonize_uri (uri);
 
-  if (is_supported_uri (uri)) {
-    xmlNodePtr presnode = Opal::Presentity::build_node (name, uri, groups);
-    xmlAddChild (roster_node, presnode);
-    trigger_saving ();
+  if (!is_supported_uri (uri)) {
+    error = _("You supplied an unsupported address");
+    return false;
+  }
 
-    Opal::PresentityPtr pres(new Presentity (*this, presence_core, existing_groups, presnode));
-    pres->trigger_saving.connect (boost::ref (trigger_saving));
-    pres->removed.connect (boost::bind (boost::ref (presentity_removed), pres));
-    pres->updated.connect (boost::bind (boost::ref (presentity_updated), pres));
-    pres->questions.connect (boost::ref (Ekiga::Heap::questions));
-    add_object (pres);
-    presentity_added (pres);
-    fetch (pres->get_uri ());
+  xmlNodePtr presnode = Opal::Presentity::build_node (name, uri, groups);
+  xmlAddChild (roster_node, presnode);
+  trigger_saving ();
 
-    return true;
-  }
-  else {
-    if (is_supported_uri (uri))
-      error = _("You supplied an unsupported address");
-    else
-      error = _("You already have a contact with this address!");
-  }
+  Opal::PresentityPtr pres(new Presentity (*this, presence_core, existing_groups, presnode));
+  pres->trigger_saving.connect (boost::ref (trigger_saving));
+  pres->removed.connect (boost::bind (boost::ref (presentity_removed), pres));
+  pres->updated.connect (boost::bind (boost::ref (presentity_updated), pres));
+  pres->questions.connect (boost::ref (Ekiga::Heap::questions));
+  add_object (pres);
+  presentity_added (pres);
+  fetch (pres->get_uri ());
 
-  return false;
+  return true;
 }
 
 void


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