[ekiga] Got rid of the AccountSubscriber api (bug #556584)
- From: Julien Puydt <jpuydt src gnome org>
- To: svn-commits-list gnome org
- Subject: [ekiga] Got rid of the AccountSubscriber api (bug #556584)
- Date: Tue, 9 Jun 2009 15:52:30 -0400 (EDT)
commit 586838f08815b2083eaa2c1858210102c3a12b15
Author: Julien Puydt <jpuydt gnome org>
Date: Tue Jun 9 21:52:00 2009 +0200
Got rid of the AccountSubscriber api (bug #556584)
---
lib/engine/account/account-core.cpp | 7 --
lib/engine/account/account-core.h | 86 ---------------------------
lib/engine/components/opal/h323-endpoint.h | 15 ++++-
lib/engine/components/opal/opal-account.cpp | 14 +++--
lib/engine/components/opal/opal-main.cpp | 4 +-
lib/engine/components/opal/sip-endpoint.h | 9 +++-
6 files changed, 29 insertions(+), 106 deletions(-)
diff --git a/lib/engine/account/account-core.cpp b/lib/engine/account/account-core.cpp
index 0953313..4df8269 100644
--- a/lib/engine/account/account-core.cpp
+++ b/lib/engine/account/account-core.cpp
@@ -91,10 +91,3 @@ Ekiga::AccountCore::visit_banks (sigc::slot1<bool, BankPtr> visitor)
iter++)
go_on = visitor (*iter);
}
-
-
-void
-Ekiga::AccountCore::add_account_subscriber (AccountSubscriber &subscriber)
-{
- account_subscribers.insert (&subscriber);
-}
diff --git a/lib/engine/account/account-core.h b/lib/engine/account/account-core.h
index f8fa7fb..7671f88 100644
--- a/lib/engine/account/account-core.h
+++ b/lib/engine/account/account-core.h
@@ -49,12 +49,6 @@
/* declaration of a few helper classes */
namespace Ekiga
{
- class AccountSubscriber
- {
- public:
- virtual ~AccountSubscriber () {}
- };
-
/**
* @defgroup accounts
* @{
@@ -160,90 +154,10 @@ namespace Ekiga
*/
ChainOfResponsibility<FormRequest*> questions;
-
- /*** Account Subscriber API ***/
- public:
- void add_account_subscriber (AccountSubscriber &subscriber);
-
- template<class T>
- bool subscribe_account (const T &account);
-
- template<class T>
- bool unsubscribe_account (const T &account);
-
- /*** Misc ***/
- private:
- std::set<AccountSubscriber *> account_subscribers;
- typedef std::set<AccountSubscriber *>::iterator subscriber_iterator;
- typedef std::set<AccountSubscriber *>::const_iterator subscriber_const_iterator;
- };
-
-
- template<class T = Account>
- class AccountSubscriberImpl : public AccountSubscriber
- {
- public:
- virtual ~AccountSubscriberImpl () {}
-
- virtual bool subscribe (const T & /*account*/);
- virtual bool unsubscribe (const T & /*account*/);
};
-
/**
* @}
*/
};
-
-
-template<class T>
-bool
-Ekiga::AccountCore::subscribe_account (const T &account)
-{
- for (subscriber_iterator iter = account_subscribers.begin ();
- iter != account_subscribers.end ();
- iter++) {
-
- Ekiga::AccountSubscriberImpl<T> *subscriber = dynamic_cast<Ekiga::AccountSubscriberImpl<T> *> (*iter);
- if (subscriber)
- if (subscriber->subscribe (account))
- return true;
- }
-
- return false;
-}
-
-
-template<class T>
-bool
-Ekiga::AccountCore::unsubscribe_account (const T &account)
-{
- for (subscriber_iterator iter = account_subscribers.begin ();
- iter != account_subscribers.end ();
- iter++) {
-
- Ekiga::AccountSubscriberImpl<T> *subscriber = dynamic_cast<Ekiga::AccountSubscriberImpl<T> *> (*iter);
- if (subscriber)
- if (subscriber->unsubscribe (account))
- return true;
- }
-
- return false;
-}
-
-
-template<class T>
-bool
-Ekiga::AccountSubscriberImpl<T>::subscribe (const T & /*account*/)
-{
- return false;
-}
-
-
-template<class T>
-bool
-Ekiga::AccountSubscriberImpl<T>::unsubscribe (const T & /*account*/)
-{
- return false;
-}
#endif
diff --git a/lib/engine/components/opal/h323-endpoint.h b/lib/engine/components/opal/h323-endpoint.h
index 266c052..ae3a660 100644
--- a/lib/engine/components/opal/h323-endpoint.h
+++ b/lib/engine/components/opal/h323-endpoint.h
@@ -57,10 +57,10 @@ namespace Opal {
namespace H323 {
class EndPoint : public H323EndPoint,
- public Ekiga::CallProtocolManager,
- public Ekiga::PresentityDecorator,
- public Ekiga::AccountSubscriberImpl<Opal::Account>,
- public Ekiga::ContactDecorator
+ public Ekiga::Service,
+ public Ekiga::CallProtocolManager,
+ public Ekiga::PresentityDecorator,
+ public Ekiga::ContactDecorator
{
PCLASSINFO(EndPoint, H323EndPoint);
@@ -69,6 +69,13 @@ namespace Opal {
~EndPoint ();
+ /* Service */
+ const std::string get_name () const
+ { return "opal-h323-endpoint"; }
+
+ const std::string get_description () const
+ { return "\tObject managing H323 objects with the Opal library"; }
+
/* ContactDecorator and PresentityDecorator */
bool populate_menu (Ekiga::ContactPtr contact,
const std::string uri,
diff --git a/lib/engine/components/opal/opal-account.cpp b/lib/engine/components/opal/opal-account.cpp
index 396eaa2..c65c72e 100644
--- a/lib/engine/components/opal/opal-account.cpp
+++ b/lib/engine/components/opal/opal-account.cpp
@@ -55,6 +55,8 @@
#include "personal-details.h"
#include "audiooutput-core.h"
+#include "sip-endpoint.h"
+
Opal::Account::Account (Ekiga::ServiceCore & _core,
const std::string & account)
: core (_core)
@@ -274,8 +276,8 @@ void Opal::Account::enable ()
{
enabled = true;
- gmref_ptr<Ekiga::AccountCore> account_core = core.get ("account-core");
- account_core->subscribe_account (*this);
+ gmref_ptr<Sip::EndPoint> endpoint = core.get ("opal-sip-endpoint");
+ endpoint->subscribe (*this);
updated.emit ();
trigger_saving.emit ();
@@ -286,8 +288,8 @@ void Opal::Account::disable ()
{
enabled = false;
- gmref_ptr<Ekiga::AccountCore> account_core = core.get ("account-core");
- account_core->unsubscribe_account (*this);
+ gmref_ptr<Sip::EndPoint> endpoint = core.get ("opal-sip-endpoint");
+ endpoint->unsubscribe (*this);
updated.emit ();
trigger_saving.emit ();
@@ -311,8 +313,8 @@ void Opal::Account::remove ()
enabled = false;
dead = true;
- gmref_ptr<Ekiga::AccountCore> account_core = core.get ("account-core");
- account_core->unsubscribe_account (*this);
+ gmref_ptr<Sip::EndPoint> endpoint = core.get ("opal-sip-endpoint");
+ endpoint->unsubscribe (*this);
trigger_saving.emit ();
diff --git a/lib/engine/components/opal/opal-main.cpp b/lib/engine/components/opal/opal-main.cpp
index 3076e36..78c20e4 100644
--- a/lib/engine/components/opal/opal-main.cpp
+++ b/lib/engine/components/opal/opal-main.cpp
@@ -116,20 +116,20 @@ struct OPALSpark: public Ekiga::Spark
unsigned sip_port = gm_conf_get_int (SIP_KEY "listen_port");
gmref_ptr<Sip::EndPoint> sip_manager (new Sip::EndPoint (*call_manager, core, sip_port));
call_manager->add_protocol_manager (sip_manager);
- account_core->add_account_subscriber (*sip_manager);
contact_core->add_contact_decorator (sip_manager);
presence_core->add_presentity_decorator (sip_manager);
presence_core->add_presence_fetcher (sip_manager);
presence_core->add_presence_publisher (sip_manager);
+ core.add (sip_manager);
#endif
#ifdef HAVE_H323
unsigned h323_port = gm_conf_get_int (H323_KEY "listen_port");
gmref_ptr<H323::EndPoint> h323_manager (new H323::EndPoint (*call_manager, core, h323_port));
call_manager->add_protocol_manager (h323_manager);
- account_core->add_account_subscriber (*h323_manager);
contact_core->add_contact_decorator (h323_manager);
presence_core->add_presentity_decorator (h323_manager);
+ core.add (h323_manager);
#endif
call_core->add_manager (call_manager);
diff --git a/lib/engine/components/opal/sip-endpoint.h b/lib/engine/components/opal/sip-endpoint.h
index 951c6c3..ad0b08f 100644
--- a/lib/engine/components/opal/sip-endpoint.h
+++ b/lib/engine/components/opal/sip-endpoint.h
@@ -61,11 +61,11 @@ namespace Opal {
namespace Sip {
class EndPoint : public SIPEndPoint,
+ public Ekiga::Service,
public Ekiga::CallProtocolManager,
public Ekiga::PresenceFetcher,
public Ekiga::PresencePublisher,
public Ekiga::PresentityDecorator,
- public Ekiga::AccountSubscriberImpl<Opal::Account>,
public Ekiga::ContactDecorator
{
PCLASSINFO(EndPoint, SIPEndPoint);
@@ -87,6 +87,13 @@ namespace Opal {
~EndPoint ();
+ /* Service */
+ const std::string get_name () const
+ { return "opal-sip-endpoint"; }
+
+ const std::string get_description () const
+ { return "\tObject managing SIP objects with the Opal library"; }
+
/* ContactDecorator and PresentityDecorator */
bool populate_menu (Ekiga::ContactPtr contact,
const std::string uri,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]