[ekiga] Finished the refactorisation of the contact/presentity decorator code in opal's directory
- From: Julien Puydt <jpuydt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ekiga] Finished the refactorisation of the contact/presentity decorator code in opal's directory
- Date: Fri, 1 Feb 2013 15:16:14 +0000 (UTC)
commit 8bff99914b7d8bc43a64f19c803c9c579ce00c01
Author: Julien Puydt <jpuydt free fr>
Date: Fri Feb 1 16:15:20 2013 +0100
Finished the refactorisation of the contact/presentity decorator code in opal's directory
Now Opal::CallManager::populate_menu works correctly, but it required some
badly organised code... which will hopefully disappear in subsequent work.
lib/engine/components/opal/opal-call-manager.cpp | 33 +++++++++++++++++++++-
lib/engine/components/opal/opal-call-manager.h | 16 ++++++++++
lib/engine/components/opal/opal-main.cpp | 9 +----
lib/engine/components/opal/sip-endpoint.cpp | 2 -
4 files changed, 50 insertions(+), 10 deletions(-)
---
diff --git a/lib/engine/components/opal/opal-call-manager.cpp b/lib/engine/components/opal/opal-call-manager.cpp
index cfc2a19..fcbf466 100644
--- a/lib/engine/components/opal/opal-call-manager.cpp
+++ b/lib/engine/components/opal/opal-call-manager.cpp
@@ -49,6 +49,11 @@
#include "call-manager.h"
#include "form-request-simple.h"
+#include "sip-endpoint.h"
+#ifdef HAVE_H323
+#include "h323-endpoint.h"
+#endif
+
#include <stdlib.h>
static bool same_codec_desc (Ekiga::CodecDescription a, Ekiga::CodecDescription b)
@@ -172,7 +177,17 @@ CallManager::populate_menu (const std::string fullname,
const std::string uri,
Ekiga::MenuBuilder& builder)
{
- return false; // FIXME: to implement
+ bool result = false;
+
+ if (uri.find ("sip:") == 0)
+ result = sip_endpoint->populate_menu (fullname, uri, builder);
+
+#ifdef HAVE_H323
+ if (uri.find ("h323:") == 0)
+ result = h323_endpoint->populate_menu (fullname, uri, builder);
+#endif
+
+ return result;
}
void CallManager::set_display_name (const std::string & name)
@@ -898,3 +913,19 @@ CallManager::CreateVideoOutputDevice(const OpalConnection & connection,
device = PVideoOutputDevice::CreateOpenedDevice(videoArgs, false);
return device != NULL;
}
+
+void
+CallManager::set_sip_endpoint (boost::shared_ptr<Opal::Sip::EndPoint> _sip_endpoint)
+{
+ sip_endpoint = _sip_endpoint;
+ add_protocol_manager (sip_endpoint);
+}
+
+#ifdef HAVE_H323
+void
+CallManager::set_h323_endpoint (boost::shared_ptr<Opal::H323::EndPoint> _h323_endpoint)
+{
+ h323_endpoint = _h323_endpoint;
+ add_protocol_manager (h323_endpoint);
+}
+#endif
diff --git a/lib/engine/components/opal/opal-call-manager.h b/lib/engine/components/opal/opal-call-manager.h
index f25f755..cfbeb90 100644
--- a/lib/engine/components/opal/opal-call-manager.h
+++ b/lib/engine/components/opal/opal-call-manager.h
@@ -39,6 +39,8 @@
#ifndef _ENDPOINT_H_
#define _ENDPOINT_H_
+#include "config.h"
+
#include <opal/buildopts.h>
#include <ptbuildopts.h>
@@ -60,6 +62,9 @@ class GMPCSSEndpoint;
namespace Opal {
+ namespace Sip { class EndPoint; };
+ namespace H323 { class EndPoint; };
+
class CallManager :
public boost::enable_shared_from_this<CallManager>,
public Ekiga::Service,
@@ -207,6 +212,17 @@ private:
bool forward_on_no_answer;
bool stun_enabled;
bool auto_answer;
+
+
+ /* FIXME: this piece of the api is because the code is getting turned around,
+ * this should disappear at some point! */
+ public:
+ void set_sip_endpoint (boost::shared_ptr<Opal::Sip::EndPoint> _sip_endpoint);
+ boost::shared_ptr<Opal::Sip::EndPoint> sip_endpoint;
+#ifdef HAVE_H323
+ void set_h323_endpoint (boost::shared_ptr<Opal::H323::EndPoint> _h323_endpoint);
+ boost::shared_ptr<Opal::H323::EndPoint> h323_endpoint;
+#endif
};
};
#endif
diff --git a/lib/engine/components/opal/opal-main.cpp b/lib/engine/components/opal/opal-main.cpp
index 25555c5..2660d7a 100644
--- a/lib/engine/components/opal/opal-main.cpp
+++ b/lib/engine/components/opal/opal-main.cpp
@@ -118,22 +118,17 @@ struct OPALSpark: public Ekiga::Spark
unsigned sip_port = gm_conf_get_int (SIP_KEY "listen_port");
boost::shared_ptr<Sip::EndPoint> sip_manager (new Sip::EndPoint (*call_manager, core, sip_port), null_deleter ());
+ call_manager->set_sip_endpoint (sip_manager);
core.add (sip_manager);
#ifdef HAVE_H323
unsigned h323_port = gm_conf_get_int (H323_KEY "listen_port");
unsigned kind_of_net = gm_conf_get_int (GENERAL_KEY "kind_of_net");
boost::shared_ptr<H323::EndPoint> h323_manager (new H323::EndPoint (*call_manager, h323_port, kind_of_net), null_deleter ());
- call_manager->add_protocol_manager (h323_manager);
- contact_core->add_contact_decorator (h323_manager);
- presence_core->add_presentity_decorator (h323_manager);
+ call_manager->set_h323_endpoint (h323_manager);
core.add (h323_manager);
#endif
- call_manager->add_protocol_manager (sip_manager);
- contact_core->add_contact_decorator (sip_manager);
- presence_core->add_presentity_decorator (sip_manager);
-
boost::shared_ptr<Bank> bank (new Bank (core));
account_core->add_bank (bank);
core.add (bank);
diff --git a/lib/engine/components/opal/sip-endpoint.cpp b/lib/engine/components/opal/sip-endpoint.cpp
index 1f41d8c..41dd77c 100644
--- a/lib/engine/components/opal/sip-endpoint.cpp
+++ b/lib/engine/components/opal/sip-endpoint.cpp
@@ -159,8 +159,6 @@ Opal::Sip::EndPoint::populate_menu (const std::string& fullname,
const std::string& uri,
Ekiga::MenuBuilder& builder)
{
- bool populated = false;
-
std::list<std::string> uris;
std::list<std::string> accounts_list;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]