ekiga r6445 - in trunk: lib/engine/account/skel lib/engine/presence/skel lib/gui src/endpoints src/gui
- From: dsandras svn gnome org
- To: svn-commits-list gnome org
- Subject: ekiga r6445 - in trunk: lib/engine/account/skel lib/engine/presence/skel lib/gui src/endpoints src/gui
- Date: Mon, 14 Jul 2008 19:58:58 +0000 (UTC)
Author: dsandras
Date: Mon Jul 14 19:58:58 2008
New Revision: 6445
URL: http://svn.gnome.org/viewvc/ekiga?rev=6445&view=rev
Log:
Changed
Modified:
trunk/lib/engine/account/skel/account-core.cpp
trunk/lib/engine/account/skel/account-core.h
trunk/lib/engine/account/skel/account.h
trunk/lib/engine/account/skel/bank-impl.h
trunk/lib/engine/account/skel/bank.h
trunk/lib/engine/presence/skel/presence-core.cpp
trunk/lib/engine/presence/skel/presence-core.h
trunk/lib/gui/xwindow.cpp
trunk/src/endpoints/h323.cpp
trunk/src/endpoints/h323.h
trunk/src/endpoints/opal-account.cpp
trunk/src/endpoints/opal-account.h
trunk/src/endpoints/sip.cpp
trunk/src/endpoints/sip.h
trunk/src/gui/accounts.cpp
trunk/src/gui/accounts.h
trunk/src/gui/main.cpp
Modified: trunk/lib/engine/account/skel/account-core.cpp
==============================================================================
--- trunk/lib/engine/account/skel/account-core.cpp (original)
+++ trunk/lib/engine/account/skel/account-core.cpp Mon Jul 14 19:58:58 2008
@@ -65,6 +65,19 @@
}
+Ekiga::Account *Ekiga::AccountCore::find_account (const std::string & aor)
+{
+ for (bank_iterator iter = banks.begin ();
+ iter != banks.end ();
+ iter++) {
+ if (Ekiga::Account *account = (*iter)->find_account (aor))
+ return account;
+ }
+
+ return NULL;
+}
+
+
void Ekiga::AccountCore::add_bank (Bank &bank)
{
banks.insert (&bank);
@@ -94,7 +107,13 @@
{
account_subscribers.insert (&subscriber);
- subscriber.registration_event.connect (registration_event.make_slot ());
+ subscriber.registration_event.connect (sigc::mem_fun (this, &Ekiga::AccountCore::on_registration_event));
}
+void Ekiga::AccountCore::on_registration_event (const Ekiga::Account *account,
+ Ekiga::AccountCore::RegistrationState state,
+ const std::string & info)
+{
+ registration_event.emit (*account, state, info);
+}
Modified: trunk/lib/engine/account/skel/account-core.h
==============================================================================
--- trunk/lib/engine/account/skel/account-core.h (original)
+++ trunk/lib/engine/account/skel/account-core.h Mon Jul 14 19:58:58 2008
@@ -133,33 +133,24 @@
typedef std::set<Bank *>::const_iterator bank_const_iterator;
- /*** 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);
-
- private:
- std::set<AccountSubscriber *> account_subscribers;
- typedef std::set<AccountSubscriber *>::iterator subscriber_iterator;
- typedef std::set<AccountSubscriber *>::const_iterator subscriber_const_iterator;
-
-
/*** Misc ***/
public:
typedef enum { Processing, Registered, Unregistered, RegistrationFailed, UnregistrationFailed } RegistrationState;
+ /** Find the account with the given address of record in the Bank
+ * @param aor is the address of record of the Account
+ * @return The Ekiga::Account if an Account was found, false otherwise.
+ */
+ Ekiga::Account *find_account (const std::string & aor);
+
/** Create the menu for the AccountCore and its actions.
* @param A MenuBuilder object to populate.
*/
bool populate_menu (MenuBuilder &builder);
+
/** This signal is emitted when the AccountCore Service has been
* updated.
*/
@@ -172,11 +163,31 @@
/** This signal is emitted when there is a new registration event
- * @param: account is the account uri
+ * @param: account is the account
* state is the state
* info contains information about the registration status
*/
- sigc::signal<void, std::string, Ekiga::AccountCore::RegistrationState, std::string> registration_event;
+ sigc::signal<void, const Ekiga::Account &, Ekiga::AccountCore::RegistrationState, std::string> registration_event;
+
+
+
+ /*** 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);
+
+ private:
+ std::set<AccountSubscriber *> account_subscribers;
+ typedef std::set<AccountSubscriber *>::iterator subscriber_iterator;
+ typedef std::set<AccountSubscriber *>::const_iterator subscriber_const_iterator;
+ void on_registration_event (const Ekiga::Account *account,
+ Ekiga::AccountCore::RegistrationState state,
+ const std::string & info);
};
@@ -185,16 +196,12 @@
public:
virtual ~AccountSubscriber () {}
- /* Implemented by the object implementing an AccountSubscriberImpl */
- virtual bool subscribe (const Ekiga::Account & account) = 0;
- virtual bool unsubscribe (const Ekiga::Account & account) = 0;
-
/** This signal is emitted when there is a new registration event
- * @param: account is the account uri
+ * @param: account is the account
* state is the state
* info contains information about the registration status
*/
- sigc::signal<void, std::string, Ekiga::AccountCore::RegistrationState, std::string> registration_event;
+ sigc::signal<void, const Ekiga::Account *, Ekiga::AccountCore::RegistrationState, std::string> registration_event;
};
@@ -223,9 +230,13 @@
for (subscriber_iterator iter = account_subscribers.begin ();
iter != account_subscribers.end ();
- iter++)
- if ((*iter)->subscribe (account))
- return true;
+ iter++) {
+
+ Ekiga::AccountSubscriberImpl<T> *subscriber = dynamic_cast<Ekiga::AccountSubscriberImpl<T> *> (*iter);
+ if (subscriber)
+ if (subscriber->subscribe (account))
+ return true;
+ }
return false;
}
@@ -239,9 +250,13 @@
for (subscriber_iterator iter = account_subscribers.begin ();
iter != account_subscribers.end ();
- iter++)
- if ((*iter)->unsubscribe (account))
- return true;
+ iter++) {
+
+ Ekiga::AccountSubscriberImpl<T> *subscriber = dynamic_cast<Ekiga::AccountSubscriberImpl<T> *> (*iter);
+ if (subscriber)
+ if (subscriber->subscribe (account))
+ return true;
+ }
return false;
}
Modified: trunk/lib/engine/account/skel/account.h
==============================================================================
--- trunk/lib/engine/account/skel/account.h (original)
+++ trunk/lib/engine/account/skel/account.h Mon Jul 14 19:58:58 2008
@@ -78,6 +78,12 @@
virtual const std::string get_protocol_name () const = 0;
+ /** Returns the address of record for that Ekiga::Account.
+ * @return The address of record.
+ */
+ virtual const std::string get_aor () const = 0;
+
+
/** Returns the hostname for the Ekiga::Account.
* This function is purely virtual and should be implemented by the
* Ekiga::Account descendant.
Modified: trunk/lib/engine/account/skel/bank-impl.h
==============================================================================
--- trunk/lib/engine/account/skel/bank-impl.h (original)
+++ trunk/lib/engine/account/skel/bank-impl.h Mon Jul 14 19:58:58 2008
@@ -98,6 +98,12 @@
*/
void visit_accounts (sigc::slot<bool, Account &> visitor);
+ /** Find the account with the given address of record in the Bank
+ * @param aor is the address of record of the Account
+ * @return The Account corresponding to the find result
+ */
+ Ekiga::Account *find_account (const std::string & aor);
+
/** This function be called when a new account has to be added to the Bank.
*/
void new_account ();
@@ -214,6 +220,23 @@
template<typename T>
+Ekiga::Account *Ekiga::BankImpl<T>::find_account (const std::string & aor)
+{
+ for (typename Ekiga::BankImpl<T>::iterator it = Lister<T>::begin ();
+ it != Lister<T>::end ();
+ it++) {
+
+ if (it->get_aor () == aor) {
+ return (&(*it));
+ }
+ else std::cout << "compared " << it->get_aor () << " and " << aor << std::endl << std::flush;
+ }
+
+ return NULL;
+}
+
+
+template<typename T>
typename Ekiga::BankImpl<T>::iterator
Ekiga::BankImpl<T>::begin ()
{
Modified: trunk/lib/engine/account/skel/bank.h
==============================================================================
--- trunk/lib/engine/account/skel/bank.h (original)
+++ trunk/lib/engine/account/skel/bank.h Mon Jul 14 19:58:58 2008
@@ -61,6 +61,14 @@
*/
virtual void visit_accounts (sigc::slot<bool, Account &> visitor) = 0;
+
+ /** Find the account with the given address of record in the Bank
+ * @param aor is the address of record of the Account
+ * @return The Account corresponding to the find result
+ */
+ virtual Ekiga::Account *find_account (const std::string & aor) = 0;
+
+
/** Create the menu for that Bank and its actions.
* This function is purely virtual and should be implemented by
* the descendant of the Ekiga::Bank.
Modified: trunk/lib/engine/presence/skel/presence-core.cpp
==============================================================================
--- trunk/lib/engine/presence/skel/presence-core.cpp (original)
+++ trunk/lib/engine/presence/skel/presence-core.cpp Mon Jul 14 19:58:58 2008
@@ -60,7 +60,7 @@
}
-void Ekiga::PresencePublisher::on_registration_event (std::string /*aor*/,
+void Ekiga::PresencePublisher::on_registration_event (const Ekiga::Account & /*account*/,
Ekiga::AccountCore::RegistrationState state,
std::string /*info*/,
Ekiga::PersonalDetails *details)
Modified: trunk/lib/engine/presence/skel/presence-core.h
==============================================================================
--- trunk/lib/engine/presence/skel/presence-core.h (original)
+++ trunk/lib/engine/presence/skel/presence-core.h Mon Jul 14 19:58:58 2008
@@ -110,7 +110,7 @@
private:
void on_personal_details_updated (PersonalDetails & details);
- void on_registration_event (std::string aor,
+ void on_registration_event (const Ekiga::Account & account,
Ekiga::AccountCore::RegistrationState state,
std::string /*info*/,
Ekiga::PersonalDetails *details);
Modified: trunk/lib/gui/xwindow.cpp
==============================================================================
--- trunk/lib/gui/xwindow.cpp (original)
+++ trunk/lib/gui/xwindow.cpp Mon Jul 14 19:58:58 2008
@@ -746,8 +746,9 @@
// send the event to the window
XLockDisplay (_display);
- if (!XSendEvent (_display, _rootWindow, FALSE, SubstructureRedirectMask | SubstructureNotifyMask, &xev))
+ if (!XSendEvent (_display, _rootWindow, FALSE, SubstructureRedirectMask | SubstructureNotifyMask, &xev)) {
PTRACE(1, "X11\tSetEWMHFullscreen failed");
+ }
XUnlockDisplay (_display);
}
}
@@ -865,8 +866,9 @@
}
// unknown WM
- if (wmType == 0)
+ if (wmType == 0) {
PTRACE(4, "X11\tUnknown wm type...");
+ }
return wmType;
}
Modified: trunk/src/endpoints/h323.cpp
==============================================================================
--- trunk/src/endpoints/h323.cpp (original)
+++ trunk/src/endpoints/h323.cpp Mon Jul 14 19:58:58 2008
@@ -276,7 +276,7 @@
}
-bool CallProtocolManager::subscribe (const Ekiga::Account & account)
+bool CallProtocolManager::subscribe (const Opal::Account & account)
{
if (account.get_protocol_name () != "H323")
return false;
@@ -288,7 +288,7 @@
}
-bool CallProtocolManager::unsubscribe (const Ekiga::Account & /*account*/)
+bool CallProtocolManager::unsubscribe (const Opal::Account & /*account*/)
{
return true;
}
@@ -311,11 +311,11 @@
H323EndPoint::RemoveGatekeeper (0);
/* Signal */
- runtime.run_in_main (sigc::bind (account_core.registration_event.make_slot (),
+/* runtime.run_in_main (sigc::bind (account_core.registration_event.make_slot (),
aor,
Ekiga::AccountCore::Processing,
std::string ()));
-
+*/
if (!authUserName.IsEmpty ()) {
SetLocalUserName (authUserName);
AddAliasName (endpoint.GetDefaultDisplayName ());
@@ -359,18 +359,22 @@
else
info = _("Failed");
+ /*
runtime.run_in_main (sigc::bind (account_core.registration_event.make_slot (),
aor,
Ekiga::AccountCore::RegistrationFailed,
info));
+ */
}
else {
/* Signal */
+ /*
runtime.run_in_main (sigc::bind (account_core.registration_event.make_slot (),
aor,
Ekiga::AccountCore::Registered,
std::string ()));
+ */
}
}
else if (unregister && IsRegisteredWithGatekeeper (host)) {
@@ -379,10 +383,12 @@
RemoveAliasName (authUserName);
/* Signal */
+ /*
runtime.run_in_main (sigc::bind (account_core.registration_event.make_slot (),
aor,
Ekiga::AccountCore::Unregistered,
std::string ()));
+ */
}
}
Modified: trunk/src/endpoints/h323.h
==============================================================================
--- trunk/src/endpoints/h323.h (original)
+++ trunk/src/endpoints/h323.h Mon Jul 14 19:58:58 2008
@@ -94,8 +94,8 @@
/* AccountSubscriber */
- bool subscribe (const Ekiga::Account & account);
- bool unsubscribe (const Ekiga::Account & account);
+ bool subscribe (const Opal::Account & account);
+ bool unsubscribe (const Opal::Account & account);
/* OPAL methods */
void Register (const PString & aor,
Modified: trunk/src/endpoints/opal-account.cpp
==============================================================================
--- trunk/src/endpoints/opal-account.cpp (original)
+++ trunk/src/endpoints/opal-account.cpp Mon Jul 14 19:58:58 2008
@@ -48,8 +48,9 @@
#include "form-request-simple.h"
-Opal::Account::Account (Ekiga::ServiceCore & core,
+Opal::Account::Account (Ekiga::ServiceCore & _core,
const std::string & account)
+: core (_core)
{
int i = 0;
char *pch = strtok ((char *) account.c_str (), "|");
@@ -103,14 +104,12 @@
i++;
}
- account_core = dynamic_cast<Ekiga::AccountCore*>(core.get ("account-core"));
-
if (enabled)
enable ();
}
-Opal::Account::Account (Ekiga::ServiceCore & core,
+Opal::Account::Account (Ekiga::ServiceCore & _core,
std::string _name,
std::string _host,
std::string _username,
@@ -118,6 +117,7 @@
std::string _password,
bool _enabled,
unsigned _timeout)
+: core (_core)
{
enabled = _enabled;
aid = (const char *) PGloballyUniqueID ().AsString ();
@@ -129,8 +129,6 @@
password = _password;
timeout = _timeout;
- account_core = dynamic_cast<Ekiga::AccountCore*>(core.get ("account-core"));
-
if (enabled)
enable ();
}
@@ -164,6 +162,14 @@
return name;
}
+const std::string Opal::Account::get_aor () const
+{
+ std::stringstream str;
+
+ str << "sip:" << username << "@" << host;
+
+ return str.str ();
+}
const std::string Opal::Account::get_protocol_name () const
{
@@ -205,6 +211,7 @@
{
enabled = true;
+ Ekiga::AccountCore *account_core = dynamic_cast<Ekiga::AccountCore*>(core.get ("account-core"));
account_core->subscribe_account (*this);
updated.emit ();
@@ -216,6 +223,7 @@
{
enabled = false;
+ Ekiga::AccountCore *account_core = dynamic_cast<Ekiga::AccountCore*>(core.get ("account-core"));
account_core->unsubscribe_account (*this);
updated.emit ();
Modified: trunk/src/endpoints/opal-account.h
==============================================================================
--- trunk/src/endpoints/opal-account.h (original)
+++ trunk/src/endpoints/opal-account.h Mon Jul 14 19:58:58 2008
@@ -67,10 +67,12 @@
bool enabled,
unsigned timeout);
- ~Account ();
+ virtual ~Account ();
const std::string get_name () const;
+ const std::string get_aor () const;
+
const std::string get_protocol_name () const;
const std::string get_host () const;
@@ -112,7 +114,7 @@
std::string auth_username;
std::string password;
- Ekiga::AccountCore *account_core;
+ Ekiga::ServiceCore & core;
};
/**
Modified: trunk/src/endpoints/sip.cpp
==============================================================================
--- trunk/src/endpoints/sip.cpp (original)
+++ trunk/src/endpoints/sip.cpp Mon Jul 14 19:58:58 2008
@@ -461,23 +461,24 @@
}
-// FIXME : check code Ekiga::Account or Opal::Account, how can we be sure the correct one is called ?
-bool CallProtocolManager::subscribe (const Ekiga::Account & account)
+bool CallProtocolManager::subscribe (const Opal::Account & account)
{
if (account.get_protocol_name () != "SIP")
return false;
new subscriber (account, *this);
+ accounts [account.get_aor ()] = &account;
return true;
}
-bool CallProtocolManager::unsubscribe (const Ekiga::Account & account)
+bool CallProtocolManager::unsubscribe (const Opal::Account & account)
{
if (account.get_protocol_name () != "SIP")
return false;
new subscriber (account, *this);
+ accounts.erase (account.get_aor ());
return true;
}
@@ -561,10 +562,11 @@
}
/* Signal */
- runtime.run_in_main (sigc::bind (account_core.registration_event.make_slot (),
- strm.str (),
- was_registering ? Ekiga::AccountCore::Registered : Ekiga::AccountCore::Unregistered,
- std::string ()));
+ Ekiga::Account *account = account_core.find_account (strm.str ());
+ if (account)
+ runtime.run_in_main (sigc::bind (registration_event.make_slot (), account,
+ was_registering ? Ekiga::AccountCore::Registered : Ekiga::AccountCore::Unregistered,
+ std::string ()));
}
@@ -767,6 +769,11 @@
info = _("Globally not acceptable");
break;
+ case SIP_PDU::Local_TransportError:
+ case SIP_PDU::Local_BadTransportAddress:
+ info = _("Transport error");
+ break;
+
case SIP_PDU::Failure_TransactionDoesNotExist:
case SIP_PDU::Failure_Gone:
case SIP_PDU::MaxStatusCode:
@@ -787,10 +794,11 @@
SIPEndPoint::OnRegistrationFailed (strm.str ().c_str (), r, wasRegistering);
/* Signal */
- runtime.run_in_main (sigc::bind (account_core.registration_event.make_slot (),
- aor,
- wasRegistering ? Ekiga::AccountCore::RegistrationFailed : Ekiga::AccountCore::UnregistrationFailed,
- info));
+ Ekiga::Account *account = account_core.find_account (strm.str ());
+ if (account)
+ runtime.run_in_main (sigc::bind (registration_event.make_slot (), account,
+ wasRegistering ? Ekiga::AccountCore::RegistrationFailed : Ekiga::AccountCore::UnregistrationFailed,
+ info));
}
Modified: trunk/src/endpoints/sip.h
==============================================================================
--- trunk/src/endpoints/sip.h (original)
+++ trunk/src/endpoints/sip.h Mon Jul 14 19:58:58 2008
@@ -128,8 +128,8 @@
/* AccountSubscriber */
- bool subscribe (const Ekiga::Account & account);
- bool unsubscribe (const Ekiga::Account & account);
+ bool subscribe (const Opal::Account & account);
+ bool unsubscribe (const Opal::Account & account);
/* OPAL Methods */
@@ -175,6 +175,7 @@
std::list<std::string> subscribed_uris; // List of subscribed uris
std::list<std::string> domains; // List of registered domains
std::list<std::string> aors; // List of registered aor
+ std::map<std::string, const Opal::Account *> accounts;
Ekiga::ServiceCore & core;
Ekiga::PresenceCore & presence_core;
Ekiga::Runtime & runtime;
Modified: trunk/src/gui/accounts.cpp
==============================================================================
--- trunk/src/gui/accounts.cpp (original)
+++ trunk/src/gui/accounts.cpp Mon Jul 14 19:58:58 2008
@@ -162,7 +162,7 @@
/* Engine callbacks */
-static void on_registration_event (std::string aor,
+static void on_registration_event (const Ekiga::Account & account,
Ekiga::AccountCore::RegistrationState state,
std::string info,
gpointer window)
@@ -199,7 +199,7 @@
}
gm_accounts_window_update_account_state (GTK_WIDGET (window), is_processing,
- aor.c_str (), status.c_str (), NULL);
+ account, status.c_str (), NULL);
}
@@ -675,7 +675,7 @@
void
gm_accounts_window_update_account_state (GtkWidget *accounts_window,
gboolean refreshing,
- const gchar *aor,
+ const Ekiga::Account & account,
const gchar *status,
const gchar *voicemails)
{
@@ -683,6 +683,7 @@
GtkTreeIter iter;
+ const gchar *aor = account.get_aor ().c_str ();
gchar *host = NULL;
gchar *realm = NULL;
gchar *username = NULL;
Modified: trunk/src/gui/accounts.h
==============================================================================
--- trunk/src/gui/accounts.h (original)
+++ trunk/src/gui/accounts.h Mon Jul 14 19:58:58 2008
@@ -41,6 +41,7 @@
#include "common.h"
#include "services.h"
+#include "account.h"
/* The API */
@@ -58,10 +59,10 @@
* the implications).
* PRE : /
*/
-
+//FIXME private
void gm_accounts_window_update_account_state (GtkWidget *accounts_window,
gboolean refreshing,
- const gchar *aor,
+ const Ekiga::Account & account,
const gchar *status,
const gchar *voicemails);
Modified: trunk/src/gui/main.cpp
==============================================================================
--- trunk/src/gui/main.cpp (original)
+++ trunk/src/gui/main.cpp Mon Jul 14 19:58:58 2008
@@ -93,6 +93,7 @@
#include "audiooutput-core.h"
#include "call-core.h"
+#include "account.h"
#include "gtk-frontend.h"
#include "services.h"
@@ -581,12 +582,13 @@
}
-static void on_registration_event (std::string aor,
+static void on_registration_event (const Ekiga::Account & account,
Ekiga::AccountCore::RegistrationState state,
- G_GNUC_UNUSED std::string info,
+ std::string /*info*/,
gpointer window)
{
gchar *msg = NULL;
+ std::string aor = account.get_aor ();
switch (state) {
case Ekiga::AccountCore::Registered:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]