[ekiga] Reworked how the actions are populated from the roster in the opal component



commit 8ec10a045b51590af5ae684a95a03ae931e7d7a5
Author: Julien Puydt <jpuydt free fr>
Date:   Tue Feb 19 21:22:43 2013 +0100

    Reworked how the actions are populated from the roster in the opal component

 lib/engine/components/opal/opal-account.cpp      |    7 ++++---
 lib/engine/components/opal/opal-bank.cpp         |   17 +++++++++++++----
 lib/engine/components/opal/opal-call-manager.cpp |   11 +++++++++--
 3 files changed, 26 insertions(+), 9 deletions(-)
---
diff --git a/lib/engine/components/opal/opal-account.cpp b/lib/engine/components/opal/opal-account.cpp
index 79173c7..9054ce6 100644
--- a/lib/engine/components/opal/opal-account.cpp
+++ b/lib/engine/components/opal/opal-account.cpp
@@ -471,10 +471,11 @@ Opal::Account::populate_menu (const std::string fullname,
   // from now on, we're sure we have an uri corresponding to the account
 
   // but does it have a domain?
-  if (complete_uri.find ("@") == string::npos) {
-
+  //
+  // (it is supposed not to, but let's still test so the function
+  // can be called from several places without problem)
+  if (complete_uri.find ("@") == string::npos)
     complete_uri = complete_uri + "@" + get_host ();
-  }
 
   call_manager->populate_menu (fullname, complete_uri, tmp_builder);
 
diff --git a/lib/engine/components/opal/opal-bank.cpp b/lib/engine/components/opal/opal-bank.cpp
index 56fbef8..a085e32 100644
--- a/lib/engine/components/opal/opal-bank.cpp
+++ b/lib/engine/components/opal/opal-bank.cpp
@@ -144,10 +144,19 @@ Opal::Bank::populate_menu_helper (const std::string fullname,
 {
   bool result = false;
 
-  for (iterator iter = begin ();
-       iter != end ();
-       ++iter)
-    result = (*iter)->populate_menu (fullname, uri, builder) || result;
+  if (uri.find ("@") == string::npos) {
+
+    // no domain: try to save the situation by trying all accounts
+
+    for (iterator iter = begin ();
+        iter != end ();
+        ++iter)
+      result = (*iter)->populate_menu (fullname, uri, builder) || result;
+  } else {
+
+    // there is a domain: just add the actions
+    result = opal_component->populate_menu (fullname, uri, builder);
+  }
 
   return result;
 }
diff --git a/lib/engine/components/opal/opal-call-manager.cpp 
b/lib/engine/components/opal/opal-call-manager.cpp
index c8b6bb8..6161c86 100644
--- a/lib/engine/components/opal/opal-call-manager.cpp
+++ b/lib/engine/components/opal/opal-call-manager.cpp
@@ -193,14 +193,21 @@ CallManager::populate_menu (const std::string fullname,
                            const std::string uri,
                            Ekiga::MenuBuilder& builder)
 {
+  std::string complete_uri;
   bool result = false;
 
+  // by default, prefer SIP
+  if (uri.find (":") == std::string::npos)
+    complete_uri = "sip:" + uri;
+  else
+    complete_uri = uri;
+
   if (uri.find ("sip:") == 0)
-    result = sip_endpoint->populate_menu (fullname, uri, builder);
+    result = sip_endpoint->populate_menu (fullname, complete_uri, builder);
 
 #ifdef HAVE_H323
   if (uri.find ("h323:") == 0)
-    result = h323_endpoint->populate_menu (fullname, uri, builder);
+    result = h323_endpoint->populate_menu (fullname, complete_uri, builder);
 #endif
 
   return result;


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