ekiga r6494 - in trunk: . src/endpoints
- From: dsandras svn gnome org
- To: svn-commits-list gnome org
- Subject: ekiga r6494 - in trunk: . src/endpoints
- Date: Thu, 24 Jul 2008 19:48:14 +0000 (UTC)
Author: dsandras
Date: Thu Jul 24 19:48:13 2008
New Revision: 6494
URL: http://svn.gnome.org/viewvc/ekiga?rev=6494&view=rev
Log:
Added back support for H.323 accounts. Small UI improvements.
Modified:
trunk/ChangeLog
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/opal-bank.cpp
trunk/src/endpoints/opal-bank.h
trunk/src/endpoints/opal-main.cpp
trunk/src/endpoints/sip.cpp
trunk/src/endpoints/sip.h
Modified: trunk/src/endpoints/h323.cpp
==============================================================================
--- trunk/src/endpoints/h323.cpp (original)
+++ trunk/src/endpoints/h323.cpp Thu Jul 24 19:48:13 2008
@@ -79,7 +79,7 @@
public:
- subscriber (const Ekiga::Account & _account,
+ subscriber (const Opal::Account & _account,
Opal::H323::CallProtocolManager & ep)
: PThread (1000, AutoDeleteThread),
account (_account),
@@ -90,16 +90,11 @@
void Main ()
{
- endpoint.Register (account.get_host (),
- account.get_authentication_username (),
- account.get_password (),
- PString (),
- account.get_timeout (),
- false);
+ endpoint.Register (account);
};
private:
- const Ekiga::Account & account;
+ const Opal::Account & account;
Opal::H323::CallProtocolManager & endpoint;
};
};
@@ -282,49 +277,43 @@
if (account.get_protocol_name () != "H323")
return false;
- /* Signal */
new subscriber (account, *this);
return true;
}
-bool CallProtocolManager::unsubscribe (const Opal::Account & /*account*/)
+bool CallProtocolManager::unsubscribe (const Opal::Account & account)
{
+ if (account.get_protocol_name () != "H323")
+ return false;
+
+ new subscriber (account, *this);
+
return true;
}
-void CallProtocolManager::Register (const PString & host,
- const PString & authUserName,
- const PString & password,
- const PString & gatekeeperID,
- unsigned int expires,
- bool unregister)
+void CallProtocolManager::Register (const Opal::Account & account)
{
- PString info;
- PString aor = authUserName + "@" + host;
+ PString gatekeeperID;
+ std::string info;
+ std::string aor = account.get_aor ();
- bool result = false;
+ bool unregister = !account.is_enabled ();
- if (!unregister && !IsRegisteredWithGatekeeper (host)) {
+ if (!unregister && !IsRegisteredWithGatekeeper (account.get_host ())) {
H323EndPoint::RemoveGatekeeper (0);
- /* Signal */
-/* runtime.run_in_main (sigc::bind (account_core.registration_event.make_slot (),
- aor,
- Ekiga::AccountCore::Processing,
- std::string ()));
-*/
- if (!authUserName.IsEmpty ()) {
- SetLocalUserName (authUserName);
+ if (!account.get_username ().empty ()) {
+ SetLocalUserName (account.get_username ());
AddAliasName (endpoint.GetDefaultDisplayName ());
}
- SetGatekeeperPassword (password);
- SetGatekeeperTimeToLive (expires * 1000);
- result = UseGatekeeper (host, gatekeeperID);
+ SetGatekeeperPassword (account.get_password ());
+ SetGatekeeperTimeToLive (account.get_timeout () * 1000);
+ bool result = UseGatekeeper (account.get_host (), gatekeeperID);
/* There was an error (missing parameter or registration failed)
or the user chose to not register */
@@ -333,7 +322,7 @@
/* Registering failed */
if (gatekeeper) {
- switch (gatekeeper->GetRegistrationFailReason()) {
+ switch (gatekeeper->GetRegistrationFailReason ()) {
case H323Gatekeeper::DuplicateAlias :
info = _("Duplicate alias");
@@ -360,36 +349,27 @@
else
info = _("Failed");
- /*
- runtime.run_in_main (sigc::bind (account_core.registration_event.make_slot (),
- aor,
+ /* Signal */
+ runtime.run_in_main (sigc::bind (registration_event.make_slot (), &account,
Ekiga::AccountCore::RegistrationFailed,
info));
- */
}
else {
- /* Signal */
- /*
- runtime.run_in_main (sigc::bind (account_core.registration_event.make_slot (),
- aor,
+ runtime.run_in_main (sigc::bind (registration_event.make_slot (), &account,
Ekiga::AccountCore::Registered,
std::string ()));
- */
}
}
- else if (unregister && IsRegisteredWithGatekeeper (host)) {
+ else if (unregister && IsRegisteredWithGatekeeper (account.get_host ())) {
H323EndPoint::RemoveGatekeeper (0);
- RemoveAliasName (authUserName);
+ RemoveAliasName (account.get_username ());
/* Signal */
- /*
- runtime.run_in_main (sigc::bind (account_core.registration_event.make_slot (),
- aor,
+ runtime.run_in_main (sigc::bind (registration_event.make_slot (), &account,
Ekiga::AccountCore::Unregistered,
std::string ()));
- */
}
}
Modified: trunk/src/endpoints/h323.h
==============================================================================
--- trunk/src/endpoints/h323.h (original)
+++ trunk/src/endpoints/h323.h Thu Jul 24 19:48:13 2008
@@ -99,12 +99,7 @@
bool unsubscribe (const Opal::Account & account);
/* OPAL methods */
- void Register (const PString & aor,
- const PString & authUserName,
- const PString & password,
- const PString & gatekeeperID,
- unsigned int expires,
- bool unregister);
+ void Register (const Opal::Account & account);
private:
bool UseGatekeeper (const PString & address = PString::Empty (),
Modified: trunk/src/endpoints/opal-account.cpp
==============================================================================
--- trunk/src/endpoints/opal-account.cpp (original)
+++ trunk/src/endpoints/opal-account.cpp Thu Jul 24 19:48:13 2008
@@ -112,6 +112,7 @@
Opal::Account::Account (Ekiga::ServiceCore & _core,
+ Type t,
std::string _name,
std::string _host,
std::string _username,
@@ -125,7 +126,7 @@
enabled = _enabled;
aid = (const char *) PGloballyUniqueID ().AsString ();
name = _name;
- protocol_name = "SIP";
+ protocol_name = (t == H323) ? "H323" : "SIP";
host = _host;
username = _username;
auth_username = _auth_username;
@@ -172,7 +173,7 @@
{
std::stringstream str;
- str << "sip:" << username << "@" << host;
+ str << (protocol_name == "SIP" ? "sip:" : "h323:") << username << "@" << host;
return str.str ();
}
Modified: trunk/src/endpoints/opal-account.h
==============================================================================
--- trunk/src/endpoints/opal-account.h (original)
+++ trunk/src/endpoints/opal-account.h Thu Jul 24 19:48:13 2008
@@ -55,10 +55,13 @@
{
public:
+ typedef enum { SIP, Ekiga, DiamondCard, H323 } Type;
+
Account (Ekiga::ServiceCore & core,
const std::string & account);
Account (Ekiga::ServiceCore & core,
+ Type t,
std::string name,
std::string host,
std::string user,
@@ -103,7 +106,7 @@
const std::string as_string () const;
sigc::signal<void> trigger_saving;
-
+
private:
void on_edit_form_submitted (Ekiga::Form &result);
Modified: trunk/src/endpoints/opal-bank.cpp
==============================================================================
--- trunk/src/endpoints/opal-bank.cpp (original)
+++ trunk/src/endpoints/opal-bank.cpp Thu Jul 24 19:48:13 2008
@@ -52,18 +52,20 @@
bool Opal::Bank::populate_menu (Ekiga::MenuBuilder & builder)
{
- builder.add_action ("new", _("_New Ekiga.net Account"),
- sigc::bind (sigc::mem_fun (this, &Opal::Bank::new_account), Ekiga, "", ""));
- builder.add_action ("new", _("_New Ekiga Call Out Account"),
- sigc::bind (sigc::mem_fun (this, &Opal::Bank::new_account), DiamondCard, "", ""));
- builder.add_action ("new", _("_New SIP Account"),
- sigc::bind (sigc::mem_fun (this, &Opal::Bank::new_account), SIP, "", ""));
+ builder.add_action ("add", _("_Add Ekiga.net Account"),
+ sigc::bind (sigc::mem_fun (this, &Opal::Bank::new_account), Opal::Account::Ekiga, "", ""));
+ builder.add_action ("add", _("_Add Ekiga Call Out Account"),
+ sigc::bind (sigc::mem_fun (this, &Opal::Bank::new_account), Opal::Account::DiamondCard, "", ""));
+ builder.add_action ("add", _("_Add SIP Account"),
+ sigc::bind (sigc::mem_fun (this, &Opal::Bank::new_account), Opal::Account::SIP, "", ""));
+ builder.add_action ("add", _("_Add H.323 Account"),
+ sigc::bind (sigc::mem_fun (this, &Opal::Bank::new_account), Opal::Account::H323, "", ""));
return true;
}
-void Opal::Bank::new_account (Type t,
+void Opal::Bank::new_account (Account::Type t,
std::string username,
std::string password)
{
@@ -74,7 +76,7 @@
switch (t) {
- case Ekiga:
+ case Opal::Account::Ekiga:
request.hidden ("name", "Ekiga.net");
request.hidden ("host", "ekiga.net");
request.text ("user", _("User:"), username);
@@ -83,7 +85,7 @@
request.hidden ("timeout", "3600");
break;
- case DiamondCard:
+ case Opal::Account::DiamondCard:
request.hidden ("name", "Ekiga Call Out");
request.hidden ("host", "sip.diamondcard.us");
request.text ("user", _("User:"), username);
@@ -92,10 +94,19 @@
request.hidden ("timeout", "3600");
break;
- case SIP:
+ case Opal::Account::H323:
+ request.text ("name", _("Name:"), std::string ());
+ request.text ("host", _("Gatekeeper:"), std::string ());
+ request.text ("user", _("User:"), username);
+ request.hidden ("authentication_user", username);
+ request.private_text ("password", _("Password:"), password);
+ request.text ("timeout", _("Timeout:"), "3600");
+ break;
+
+ case Opal::Account::SIP:
default:
request.text ("name", _("Name:"), std::string ());
- request.text ("host", _("Host"), std::string ());
+ request.text ("host", _("Registrar:"), std::string ());
request.text ("user", _("User:"), username);
request.text ("authentication_user", _("Authentication User:"), std::string ());
request.private_text ("password", _("Password:"), password);
@@ -119,20 +130,21 @@
void Opal::Bank::on_new_account_form_submitted (Ekiga::Form &result,
- Type t)
+ Account::Type t)
{
try {
Ekiga::FormRequestSimple request;
std::string error;
- std::string new_name = (t == SIP) ? result.text ("name") : result.hidden ("name");
- std::string new_host = (t == SIP) ? result.text ("host") : result.hidden ("host");
+ std::string new_name = (t == Opal::Account::SIP || t == Opal::Account::H323) ? result.text ("name") : result.hidden ("name");
+ std::string new_host = (t == Opal::Account::SIP || t == Opal::Account::H323) ? result.text ("host") : result.hidden ("host");
std::string new_user = result.text ("user");
- std::string new_authentication_user = (t == SIP) ? result.text ("authentication_user") : new_user;
+ std::string new_authentication_user = (t == Opal::Account::SIP) ? result.text ("authentication_user") : new_user;
std::string new_password = result.private_text ("password");
bool new_enabled = result.boolean ("enabled");
- unsigned new_timeout = atoi ((t == SIP) ? result.text ("timeout").c_str () : result.hidden ("timeout").c_str ());
+ unsigned new_timeout = atoi ((t == Opal::Account::SIP || t == Opal::Account::H323) ?
+ result.text ("timeout").c_str () : result.hidden ("timeout").c_str ());
result.visit (request);
@@ -158,7 +170,7 @@
}
else {
- add (new_name, new_host, new_user, new_authentication_user, new_password, new_enabled, new_timeout);
+ add (t, new_name, new_host, new_user, new_authentication_user, new_password, new_enabled, new_timeout);
save ();
}
@@ -169,7 +181,8 @@
}
-void Opal::Bank::add (std::string name,
+void Opal::Bank::add (Account::Type t,
+ std::string name,
std::string host,
std::string user,
std::string auth_user,
@@ -177,7 +190,7 @@
bool enabled,
unsigned timeout)
{
- Opal::Account *account = new Opal::Account (core, name, host, user, auth_user, password, enabled, timeout);
+ Opal::Account *account = new Opal::Account (core, t, name, host, user, auth_user, password, enabled, timeout);
add_account (*account);
}
Modified: trunk/src/endpoints/opal-bank.h
==============================================================================
--- trunk/src/endpoints/opal-bank.h (original)
+++ trunk/src/endpoints/opal-bank.h Thu Jul 24 19:48:13 2008
@@ -66,16 +66,15 @@
const std::string get_description () const
{ return "\tStores the call history"; }
- typedef enum { SIP, Ekiga, DiamondCard } Type;
-
- void new_account (Type t,
+ void new_account (Account::Type t,
std::string username = "",
std::string password = "");
private:
- void on_new_account_form_submitted (Ekiga::Form & form, Type t);
+ void on_new_account_form_submitted (Ekiga::Form & form, Account::Type t);
- void add (std::string name,
+ void add (Account::Type t,
+ std::string name,
std::string host,
std::string user,
std::string auth_user,
Modified: trunk/src/endpoints/opal-main.cpp
==============================================================================
--- trunk/src/endpoints/opal-main.cpp (original)
+++ trunk/src/endpoints/opal-main.cpp Thu Jul 24 19:48:13 2008
@@ -67,6 +67,7 @@
Opal::Bank *bank = new Bank (*core);
account_core->add_bank (*bank);
+ core->add (*bank);
}
bool
@@ -98,12 +99,12 @@
call_manager->add_protocol_manager (*h323_manager);
call_core->add_manager (*call_manager);
- core.add (*call_manager); // FIXME temporary
+
account_core->add_account_subscriber (*sip_manager);
+ account_core->add_account_subscriber (*h323_manager);
new ConfBridge (*call_manager);
call_manager->start ();
- // FIXME Service ?
// Add the bank of accounts when the CallManager is ready
call_manager->ready.connect (sigc::bind (sigc::ptr_fun (on_call_manager_ready_cb), &core));
Modified: trunk/src/endpoints/sip.cpp
==============================================================================
--- trunk/src/endpoints/sip.cpp (original)
+++ trunk/src/endpoints/sip.cpp Thu Jul 24 19:48:13 2008
@@ -86,7 +86,7 @@
PCLASSINFO(subscriber, PThread);
public:
- subscriber (const Ekiga::Account & _account,
+ subscriber (const Opal::Account & _account,
Opal::Sip::CallProtocolManager & ep)
: PThread (1000, AutoDeleteThread),
account (_account),
@@ -101,7 +101,7 @@
};
private:
- const Ekiga::Account & account;
+ const Opal::Account & account;
Opal::Sip::CallProtocolManager & endpoint;
};
};
@@ -452,7 +452,6 @@
return false;
new subscriber (account, *this);
- accounts [account.get_aor ()] = &account;
return true;
}
@@ -463,7 +462,6 @@
return false;
new subscriber (account, *this);
- accounts.erase (account.get_aor ());
return true;
}
@@ -484,7 +482,7 @@
}
-void CallProtocolManager::Register (const Ekiga::Account & account)
+void CallProtocolManager::Register (const Opal::Account & account)
{
std::stringstream aor;
Modified: trunk/src/endpoints/sip.h
==============================================================================
--- trunk/src/endpoints/sip.h (original)
+++ trunk/src/endpoints/sip.h Thu Jul 24 19:48:13 2008
@@ -134,7 +134,7 @@
/* OPAL Methods */
void ShutDown ();
- void Register (const Ekiga::Account & account);
+ void Register (const Opal::Account & account);
void OnRegistered (const PString & aor,
bool wasRegistering);
@@ -172,7 +172,6 @@
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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]