[ekiga] Pushed the populate_menu work in the opal start one step further



commit 7f34fec7e269a66cf7c6213593d49223bc64ee2b
Author: Julien Puydt <jpuydt free fr>
Date:   Fri Feb 1 14:37:54 2013 +0100

    Pushed the populate_menu work in the opal start one step further
    
    Now Opal::Account's implementation is complete, but Opal::CallManager isn't

 lib/engine/components/opal/opal-account.cpp      |   38 ++++++++++++++++++++--
 lib/engine/components/opal/opal-call-manager.cpp |    7 ++++
 lib/engine/components/opal/opal-call-manager.h   |    9 ++++-
 3 files changed, 50 insertions(+), 4 deletions(-)
---
diff --git a/lib/engine/components/opal/opal-account.cpp b/lib/engine/components/opal/opal-account.cpp
index a41baae..bc50086 100644
--- a/lib/engine/components/opal/opal-account.cpp
+++ b/lib/engine/components/opal/opal-account.cpp
@@ -466,12 +466,44 @@ Opal::Account::populate_menu (const std::string fullname,
 			      const std::string uri,
 			      Ekiga::MenuBuilder& builder)
 {
+  boost::shared_ptr<Opal::CallManager> call_manager = opal_component.lock ();
+
+  if (!call_manager)
+    return false;
+
   bool result = false;
   Ekiga::TemporaryMenuBuilder tmp_builder;
+  std::string protocol;
+  std::string complete_uri;
+
+  // if there is no protocol, add what we are
+  if (uri.find (":") == string::npos) {
+
+    if (type == H323)
+      protocol = "h323:";
+    else
+      protocol = "sip:";
+    complete_uri = protocol + uri;
+  }
+
+  // whatever the protocol was previously, check if it fits
+  if (
+      (type == H323 && complete_uri.find ("h323:" != 0))
+      ||
+      (type != H323 && complete_uri.find ("sip:" != 0))
+      )
+    return false;
+
+  // 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) {
+
+    complete_uri = complete_uri + "@" + get_host ();
+  }
+
+  call_manager->populate_menu (fullname, complete_uri, tmp_builder);
 
-  // FIXME: give tmp_builder to the call manager ;
-  // it will give it to one of the endpoints ;
-  // and this endpoint will add the real stuff!
   if ( !tmp_builder.empty ()) {
 
     builder.add_ghost ("", get_name ());
diff --git a/lib/engine/components/opal/opal-call-manager.cpp b/lib/engine/components/opal/opal-call-manager.cpp
index c18fcac..cfc2a19 100644
--- a/lib/engine/components/opal/opal-call-manager.cpp
+++ b/lib/engine/components/opal/opal-call-manager.cpp
@@ -167,6 +167,13 @@ CallManager::~CallManager ()
   g_async_queue_unref (queue);
 }
 
+bool
+CallManager::populate_menu (const std::string fullname,
+			    const std::string uri,
+			    Ekiga::MenuBuilder& builder)
+{
+  return false; // FIXME: to implement
+}
 
 void CallManager::set_display_name (const std::string & name)
 {
diff --git a/lib/engine/components/opal/opal-call-manager.h b/lib/engine/components/opal/opal-call-manager.h
index e790aa2..f25f755 100644
--- a/lib/engine/components/opal/opal-call-manager.h
+++ b/lib/engine/components/opal/opal-call-manager.h
@@ -47,6 +47,8 @@
 #include <h323/h323.h>
 #include <sip/sip.h>
 
+#include "menu-builder.h"
+
 #include "call-manager.h"
 #include "opal-call.h"
 
@@ -72,13 +74,18 @@ public:
 
     ~CallManager ();
 
-    /**/
+    /* Ekiga::Service implementation */
     const std::string get_name () const
       { return "opal-component"; }
 
     const std::string get_description () const
       { return "\tObject bringing in Opal support (calls, text messaging, sip, h323, ...)"; }
 
+    /* helper function for the Opal::Bank contact/presentity decorator work */
+    bool populate_menu (const std::string fullname,
+			const std::string uri,
+			Ekiga::MenuBuilder& builder);
+
     /** Call Manager **/
     bool dial (const std::string & uri); 
 



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