ekiga r7604 - in trunk: lib/engine/account lib/engine/components/opal src/gui



Author: jpuydt
Date: Sat Jan 24 20:19:47 2009
New Revision: 7604
URL: http://svn.gnome.org/viewvc/ekiga?rev=7604&view=rev

Log:
Pushed the find_account method to the Opal::Bank, modified the rest of the code to cope, then fixed bug #568980

Modified:
   trunk/lib/engine/account/account-core.cpp
   trunk/lib/engine/account/account-core.h
   trunk/lib/engine/components/opal/h323-endpoint.cpp
   trunk/lib/engine/components/opal/opal-bank.cpp
   trunk/lib/engine/components/opal/opal-bank.h
   trunk/lib/engine/components/opal/opal-call-manager.cpp
   trunk/lib/engine/components/opal/opal-main.cpp
   trunk/lib/engine/components/opal/sip-endpoint.cpp
   trunk/lib/engine/components/opal/sip-endpoint.h
   trunk/src/gui/assistant.cpp

Modified: trunk/lib/engine/account/account-core.cpp
==============================================================================
--- trunk/lib/engine/account/account-core.cpp	(original)
+++ trunk/lib/engine/account/account-core.cpp	Sat Jan 24 20:19:47 2009
@@ -65,19 +65,6 @@
 }
 
 
-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);

Modified: trunk/lib/engine/account/account-core.h
==============================================================================
--- trunk/lib/engine/account/account-core.h	(original)
+++ trunk/lib/engine/account/account-core.h	Sat Jan 24 20:19:47 2009
@@ -147,14 +147,6 @@
   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 or the host to look 
-     *        for
-     * @return The Ekiga::Account if an Account was found, false otherwise.
-     *         The returned account should not be freed.
-     */
-    Ekiga::Account *find_account (const std::string & aor);
-
 
     /** Create the menu for the AccountCore and its actions.
      * @param A MenuBuilder object to populate.

Modified: trunk/lib/engine/components/opal/h323-endpoint.cpp
==============================================================================
--- trunk/lib/engine/components/opal/h323-endpoint.cpp	(original)
+++ trunk/lib/engine/components/opal/h323-endpoint.cpp	Sat Jan 24 20:19:47 2009
@@ -43,6 +43,13 @@
 #include "opal-call.h"
 #include "account-core.h"
 
+static void
+registration_event_in_main (sigc::slot2<void, Ekiga::AccountCore::RegistrationState, std::string> slot,
+			    Ekiga::AccountCore::RegistrationState state,
+			    const std::string msg)
+{
+  slot (state, msg);
+}
 
 namespace Opal {
 
@@ -325,13 +332,15 @@
         info = _("Failed");
 
       /* Signal */
-      runtime->run_in_main (sigc::bind (account.registration_event.make_slot (),
+      runtime->run_in_main (sigc::bind (sigc::ptr_fun(registration_event_in_main),
+					account.registration_event.make_slot (),
 					Ekiga::AccountCore::RegistrationFailed,
 					info));
     }
     else {
 
-      runtime->run_in_main (sigc::bind (account.registration_event.make_slot (),
+      runtime->run_in_main (sigc::bind (sigc::ptr_fun(registration_event_in_main),
+					account.registration_event.make_slot (),
 					Ekiga::AccountCore::Registered,
 					std::string ()));
     }
@@ -342,7 +351,8 @@
     RemoveAliasName (account.get_username ());
 
     /* Signal */
-    runtime->run_in_main (sigc::bind (account.registration_event.make_slot (),
+    runtime->run_in_main (sigc::bind (sigc::ptr_fun(registration_event_in_main),
+				      account.registration_event.make_slot (),
 				      Ekiga::AccountCore::Unregistered,
 				      std::string ()));
   }

Modified: trunk/lib/engine/components/opal/opal-bank.cpp
==============================================================================
--- trunk/lib/engine/components/opal/opal-bank.cpp	(original)
+++ trunk/lib/engine/components/opal/opal-bank.cpp	Sat Jan 24 20:19:47 2009
@@ -208,3 +208,21 @@
       iter->enable ();
   }
 }
+
+Opal::Account*
+Opal::Bank::find_account (const std::string& aor)
+{
+  Opal::Account* result = NULL;
+  bool found = false;
+
+  for (iterator iter = begin ();
+       !found && iter != end ();
+       ++iter) {
+
+    if (iter->get_aor () == aor) {
+
+      found = true;
+      result = &*iter;
+    }
+  }
+}

Modified: trunk/lib/engine/components/opal/opal-bank.h
==============================================================================
--- trunk/lib/engine/components/opal/opal-bank.h	(original)
+++ trunk/lib/engine/components/opal/opal-bank.h	Sat Jan 24 20:19:47 2009
@@ -70,6 +70,15 @@
                       std::string username = "",
                       std::string password = "");
 
+    /** Find the account with the given address of record in the Bank
+     * @param aor is the address of record of the Account or the host to look 
+     *        for
+     * @return The Opal::Account if an Account was found, false otherwise.
+     *         The returned account should not be freed.
+     */
+    Opal::Account* find_account (const std::string& aor);
+
+
     void stun_ready ();
 
     /** This signal is emitted when there is a new message waiting event

Modified: trunk/lib/engine/components/opal/opal-call-manager.cpp
==============================================================================
--- trunk/lib/engine/components/opal/opal-call-manager.cpp	(original)
+++ trunk/lib/engine/components/opal/opal-call-manager.cpp	Sat Jan 24 20:19:47 2009
@@ -175,8 +175,7 @@
     new StunDetector (stun_server, *this, queue);
     patience = 20;
     runtime->run_in_main (sigc::mem_fun (this, &CallManager::HandleSTUNResult), 1);
-  }
-  else
+  } else
     ready.emit ();
 }
 

Modified: trunk/lib/engine/components/opal/opal-main.cpp
==============================================================================
--- trunk/lib/engine/components/opal/opal-main.cpp	(original)
+++ trunk/lib/engine/components/opal/opal-main.cpp	Sat Jan 24 20:19:47 2009
@@ -106,6 +106,11 @@
 
       gmref_ptr<CallManager> call_manager (new CallManager (core));
 
+      gmref_ptr<Opal::Bank> bank (new Bank (core));
+
+      account_core->add_bank (*bank);
+      core.add (bank);
+      call_manager->ready.connect (sigc::mem_fun (*bank, &Opal::Bank::stun_ready));
 
 #ifdef HAVE_SIP
       unsigned sip_port = gm_conf_get_int (SIP_KEY "listen_port");
@@ -136,12 +141,6 @@
       call_manager->start ();
       presence_core->add_supported_uri (sigc::ptr_fun (is_supported_address)); //FIXME
 
-      gmref_ptr<Opal::Bank> bank (new Bank (core));
-
-      account_core->add_bank (*bank);
-      core.add (bank);
-      call_manager->ready.connect (sigc::mem_fun (*bank, &Opal::Bank::stun_ready));
-
       OpalLinkerHacks::loadOpalVideoInput = 1;
       OpalLinkerHacks::loadOpalVideoOutput = 1;
       OpalLinkerHacks::loadOpalAudio = 1;

Modified: trunk/lib/engine/components/opal/sip-endpoint.cpp
==============================================================================
--- trunk/lib/engine/components/opal/sip-endpoint.cpp	(original)
+++ trunk/lib/engine/components/opal/sip-endpoint.cpp	Sat Jan 24 20:19:47 2009
@@ -54,6 +54,14 @@
 #include "opal-account.h"
 
 static void
+registration_event_in_main (sigc::slot2<void, Ekiga::AccountCore::RegistrationState, std::string> slot,
+			    Ekiga::AccountCore::RegistrationState state,
+			    const std::string msg)
+{
+  slot (state, msg);
+}
+
+static void
 presence_status_in_main (Ekiga::PresenceFetcher* fetcher,
                          std::string uri,
                          std::string presence,
@@ -91,15 +99,15 @@
 
   public:
       subscriber (const Opal::Account & _account,
-                  Opal::Sip::EndPoint & _manager) 
+                  Opal::Sip::EndPoint & _manager)
         : PThread (1000, AutoDeleteThread),
         account (_account),
-        manager (_manager) 
+        manager (_manager)
       {
         this->Resume ();
       };
 
-      void Main () 
+      void Main ()
         {
           manager.Register (account);
         };
@@ -114,11 +122,11 @@
 
 
 /* The class */
-Opal::Sip::EndPoint::EndPoint (Opal::CallManager & _manager, 
-                               Ekiga::ServiceCore & _core, 
+Opal::Sip::EndPoint::EndPoint (Opal::CallManager & _manager,
+                               Ekiga::ServiceCore & _core,
                                unsigned _listen_port)
 :   SIPEndPoint (_manager),
-    manager (_manager), 
+    manager (_manager),
     core (_core)
 {
   gmref_ptr<Ekiga::ChatCore> chat_core = core.get ("chat-core");
@@ -129,9 +137,9 @@
     runtime = &*smart;
   }
   {
-    gmref_ptr<Ekiga::AccountCore> smart = core.get ("account-core");
+    gmref_ptr<Opal::Bank> smart = core.get ("opal-account-store");
     smart->reference (); // take a reference in the main thread
-    account_core = &*smart;
+    bank = &*smart;
   }
 
 
@@ -169,7 +177,7 @@
 Opal::Sip::EndPoint::~EndPoint ()
 {
   runtime->unreference (); // leave a reference in the main thread
-  account_core->unreference (); // leave a reference in the main thread
+  bank->unreference (); // leave a reference in the main thread
   dialect->unreference (); // leave a reference in the main thread
 }
 
@@ -205,41 +213,35 @@
 
   if (uri.find ("@") == string::npos) {
 
-    gmref_ptr<Opal::Bank> bank = core.get ("opal-account-store");
+    for (Opal::Bank::iterator it = bank->begin ();
+	 it != bank->end ();
+	 it++) {
 
-    if (bank) {
+      if (it->get_protocol_name () == "SIP" && it->is_active ()) {
 
-      for (Opal::Bank::iterator it = bank->begin ();
-           it != bank->end ();
-           it++) {
+	std::stringstream uristr;
+	std::string str = uri;
 
-        if (it->get_protocol_name () == "SIP" && it->is_active ()) {
+	for (unsigned i = 0 ; i < str.length() ; i++) {
 
-          std::stringstream uristr;
-          std::string str = uri;
+	  if (str [i] == ' ' || str [i] == '-') {
+	    str.erase (i,1);
+	    i--;
+	  }
+	}
 
-          for (unsigned i = 0 ; i < str.length() ; i++) {
+	if (str.find ("sip:") == string::npos)
+	  uristr << "sip:" << str;
+	else
+	  uristr << str;
 
-            if (str [i] == ' ' || str [i] == '-') {
-              str.erase (i,1);
-              i--;
-            }
-          }
+	uristr << "@" << it->get_host ();
 
-          if (str.find ("sip:") == string::npos)
-            uristr << "sip:" << str;
-          else
-            uristr << str;
-
-          uristr << "@" << it->get_host ();
-
-          uris.push_back (uristr.str ());
-          accounts.push_back (it->get_name ());
-        }
+	uris.push_back (uristr.str ());
+	accounts.push_back (it->get_name ());
       }
     }
-  }
-  else {
+  } else {
     uris.push_back (uri);
     accounts.push_back ("");
   }
@@ -263,7 +265,7 @@
     if (0 == GetConnectionCount ())
       builder.add_action ("call", call_action.str (),
                           sigc::bind (sigc::mem_fun (this, &Opal::Sip::EndPoint::on_dial), (*it)));
-    else 
+    else
       builder.add_action ("transfer", transfer_action.str (),
                           sigc::bind (sigc::mem_fun (this, &Opal::Sip::EndPoint::on_transfer), (*it)));
 
@@ -276,7 +278,7 @@
        it++) {
 
     std::stringstream msg_action;
-    if (!(*ita).empty ()) 
+    if (!(*ita).empty ())
       msg_action << _("Message") << " [" << (*ita) << "]";
     else
       msg_action << _("Message");
@@ -298,13 +300,13 @@
   std::string::size_type loc = _uri.find ("@", 0);
   std::string domain;
 
-  if (loc != string::npos) 
+  if (loc != string::npos)
     domain = _uri.substr (loc+1);
 
   // It is not in the list of uris for which a subscribe is active
   if (std::find (subscribed_uris.begin (), subscribed_uris.end (), _uri) == subscribed_uris.end ()) {
 
-    // The account is active 
+    // The account is active
     if (std::find (active_domains.begin (), active_domains.end (), domain) != active_domains.end ()) {
 
       Subscribe (SIPSubscribe::Presence, 300, PString (_uri.c_str ()));
@@ -312,7 +314,7 @@
       subscribed_uris.push_back (_uri);
     }
     else {
-     
+
       to_subscribe_uris.push_back (_uri);
     }
   }
@@ -348,7 +350,7 @@
     data += "\">\r\n";
 
     data += "<tuple id=\"";
-    data += to; 
+    data += to;
     data += "_on_";
     data += hostname;
     data += "\">\r\n";
@@ -374,12 +376,12 @@
     data += "</tuple>\r\n";
     data += "</presence>\r\n";
 
-    Publish (to, data, 500); // TODO: allow to change the 500 
+    Publish (to, data, 500); // TODO: allow to change the 500
   }
 }
 
 
-bool Opal::Sip::EndPoint::send_message (const std::string & _uri, 
+bool Opal::Sip::EndPoint::send_message (const std::string & _uri,
                                         const std::string & _message)
 {
   if (!_uri.empty () && (_uri.find ("sip:") == 0 || _uri.find (':') == string::npos) && !_message.empty ()) {
@@ -544,7 +546,7 @@
   std::string domain;
   std::string::size_type loc = aor.find ("@", 0);
 
-  if (loc != string::npos) 
+  if (loc != string::npos)
     domain = aor.substr (loc+1);
 
   return domain;
@@ -580,7 +582,7 @@
   if (loc != std::string::npos)
     host = host.substr (0, loc);
 
-  if (account.get_username ().find ("@") == std::string::npos) 
+  if (account.get_username ().find ("@") == std::string::npos)
     aor << account.get_username () << "@" << host;
   else
     aor << account.get_username ();
@@ -593,7 +595,7 @@
   params.m_expire = (account.is_enabled () ? account.get_timeout () : 0);
   params.m_minRetryTime = 0;
   params.m_maxRetryTime = 0;
-  
+
   // Update the list of active domains
   std::string domain = Opal::Sip::EndPoint::get_aor_domain (aor.str ());
   bool found = (std::find (active_domains.begin (), active_domains.end (), domain) != active_domains.end ());
@@ -617,7 +619,7 @@
   std::string server;
   std::stringstream strm;
 
-  if (aor.find (uri_prefix) == std::string::npos) 
+  if (aor.find (uri_prefix) == std::string::npos)
     strm << uri_prefix << aor;
   else
     strm << aor;
@@ -642,8 +644,8 @@
       return;
 
     if (was_registering) {
-      for (std::list<std::string>::const_iterator iter = to_subscribe_uris.begin (); 
-           iter != to_subscribe_uris.end () ; ) { 
+      for (std::list<std::string>::const_iterator iter = to_subscribe_uris.begin ();
+           iter != to_subscribe_uris.end () ; ) {
 
         found = (*iter).find (server, 0);
         if (found != string::npos) {
@@ -658,8 +660,8 @@
       }
     }
     else {
-      for (std::list<std::string>::const_iterator iter = subscribed_uris.begin (); 
-           iter != subscribed_uris.end () ; ) { 
+      for (std::list<std::string>::const_iterator iter = subscribed_uris.begin ();
+           iter != subscribed_uris.end () ; ) {
 
         found = (*iter).find (server, 0);
         if (found != string::npos) {
@@ -680,11 +682,12 @@
     Subscribe (SIPSubscribe::MessageSummary, 3600, aor);
 
   /* Signal */
-  Ekiga::Account *account = account_core->find_account (strm.str ());
-  if (account)
-    runtime->run_in_main (sigc::bind (account->registration_event.make_slot (),
-				      was_registering ? Ekiga::AccountCore::Registered : Ekiga::AccountCore::Unregistered,
-                                     std::string ()));
+  Opal::Account *account = bank->find_account (strm.str ());
+  //if (account)
+  //  runtime->run_in_main (sigc::bind (sigc::ptr_fun(registration_event_in_main),
+  //			      account->registration_event.make_slot (),
+  //			      was_registering ? Ekiga::AccountCore::Registered : Ekiga::AccountCore::Unregistered,
+  //			      std::string ()));
 }
 
 
@@ -696,7 +699,7 @@
   std::string info;
   std::string aor = (const char *) _aor;
 
-  if (aor.find (uri_prefix) == std::string::npos) 
+  if (aor.find (uri_prefix) == std::string::npos)
     strm << uri_prefix << aor;
   else
     strm << aor;
@@ -792,7 +795,7 @@
     break;
 
   case SIP_PDU::Failure_BadExtension:
-    // Translators : The extension we are trying to register does not exist 
+    // Translators : The extension we are trying to register does not exist
     info = _("Bad extension");
     break;
 
@@ -913,11 +916,12 @@
   SIPEndPoint::OnRegistrationFailed (strm.str ().c_str (), r, wasRegistering);
 
   /* Signal */
-  Ekiga::Account *account = account_core->find_account (strm.str ());
+  Opal::Account *account = bank->find_account (strm.str ());
   if (account)
-    runtime->run_in_main (sigc::bind (account->registration_event.make_slot (),
+    runtime->run_in_main (sigc::bind (sigc::ptr_fun(registration_event_in_main),
+				      account->registration_event.make_slot (),
 				      wasRegistering ? Ekiga::AccountCore::RegistrationFailed : Ekiga::AccountCore::UnregistrationFailed,
-                                     info));
+				      info));
 }
 
 
@@ -929,7 +933,7 @@
     mwi = "0/0";
 
   /* Signal */
-  Ekiga::Account *account = account_core->find_account (party);
+  Opal::Account *account = bank->find_account (party);
   if (account)
     runtime->run_in_main (sigc::bind (account->mwi_event.make_slot (), info));
 }
@@ -943,7 +947,7 @@
 
   if (!forward_uri.empty () && manager.get_unconditional_forward ())
     connection.ForwardCall (forward_uri);
-  else if (manager.GetCallCount () > 1) { 
+  else if (manager.GetCallCount () > 1) {
 
     if (!forward_uri.empty () && manager.get_forward_on_busy ())
       connection.ForwardCall (forward_uri);
@@ -956,7 +960,7 @@
     Opal::Call *call = dynamic_cast<Opal::Call *> (&connection.GetCall ());
     if (call) {
 
-      if (!forward_uri.empty () && manager.get_forward_on_no_answer ()) 
+      if (!forward_uri.empty () && manager.get_forward_on_no_answer ())
         call->set_no_answer_forward (manager.get_reject_delay (), forward_uri);
       else
         call->set_reject_delay (manager.get_reject_delay ());
@@ -975,7 +979,7 @@
   PString *last = NULL;
   PString *val = NULL;
 
-  PString from = pdu.GetMIME().GetFrom();   
+  PString from = pdu.GetMIME().GetFrom();
   PINDEX j = from.Find (';');
   if (j != P_MAX_INDEX)
     from = from.Left(j); // Remove all parameters
@@ -1034,14 +1038,14 @@
   }
   else {
 
-    /* If we are not registered to host, 
+    /* If we are not registered to host,
      * then use the default account as outgoing identity.
      * If we are exchanging messages with a peer on our network,
      * then do not use the default account as outgoing identity.
      */
     if (host.GetHostAddress ().GetIpAndPort (address, port) && !manager.IsLocalAddress (address)) {
 
-      Ekiga::Account *account = account_core->find_account ("ekiga.net");
+      Opal::Account *account = bank->find_account ("Ekiga.net");
 
       if (account)
         return SIPURL ("\"" + GetDefaultDisplayName () + "\" <" + PString(account->get_aor ()) + ">");
@@ -1049,13 +1053,13 @@
   }
 
   /* As a last resort, ie not registered to host, no default account or
-   * dialog with a local peer, then use the local address 
+   * dialog with a local peer, then use the local address
    */
   return GetDefaultRegisteredPartyName (transport);
 }
 
 
-void 
+void
 Opal::Sip::EndPoint::OnPresenceInfoReceived (const PString & user,
                                              const PString & basic,
                                              const PString & note)
@@ -1081,10 +1085,10 @@
     else if (s.Find ("Ringing") != P_MAX_INDEX)
       presence = "ringing";
     else if (s.Find ("dnd") != P_MAX_INDEX
-             || s.Find ("Do Not Disturb") != P_MAX_INDEX) 
+             || s.Find ("Do Not Disturb") != P_MAX_INDEX)
       presence = "dnd";
 
-    else if (s.Find ("Free For Chat") != P_MAX_INDEX) 
+    else if (s.Find ("Free For Chat") != P_MAX_INDEX)
       presence = "freeforchat";
 
     if ((j = s.Find (" - ")) != P_MAX_INDEX)
@@ -1102,8 +1106,8 @@
     presence = "offline";
 
   // If presence change, then signal it to the various components
-  // If presence is unknown (notification with empty body), and it is not the 
-  // first notification, and we can conclude it is a ping back from the server 
+  // If presence is unknown (notification with empty body), and it is not the
+  // first notification, and we can conclude it is a ping back from the server
   // to indicate the presence status did not change, hence we do nothing.
   if (presence != "unknown" && (old_presence != presence || old_status != status)) {
     presence_infos[_uri].presence = presence;
@@ -1113,7 +1117,7 @@
 }
 
 
-void 
+void
 Opal::Sip::EndPoint::OnDialogInfoReceived (const SIPDialogNotification & info)
 {
   gchar* _status = NULL;

Modified: trunk/lib/engine/components/opal/sip-endpoint.h
==============================================================================
--- trunk/lib/engine/components/opal/sip-endpoint.h	(original)
+++ trunk/lib/engine/components/opal/sip-endpoint.h	Sat Jan 24 20:19:47 2009
@@ -44,8 +44,7 @@
 #include "presence-core.h"
 #include "call-manager.h"
 #include "call-protocol-manager.h"
-#include "account-core.h"
-#include "opal-account.h"
+#include "opal-bank.h"
 #include "sip-dialect.h"
 #include "call-core.h"
 #include "contact-core.h"
@@ -196,7 +195,7 @@
       std::list<std::string> aors;               // List of registered aor
       Ekiga::ServiceCore & core;
       Ekiga::Runtime* runtime;
-      Ekiga::AccountCore* account_core;
+      Opal::Bank* bank;
 
       Ekiga::CallProtocolManager::Interface listen_iface;
 

Modified: trunk/src/gui/assistant.cpp
==============================================================================
--- trunk/src/gui/assistant.cpp	(original)
+++ trunk/src/gui/assistant.cpp	Sat Jan 24 20:19:47 2009
@@ -633,9 +633,8 @@
 static void
 prepare_ekiga_net_page (EkigaAssistant *assistant)
 {
-  gmref_ptr<Ekiga::AccountCore> account_core
-    = assistant->priv->core->get ("account-core");
-  Ekiga::Account *account = account_core->find_account ("ekiga.net");
+  gmref_ptr<Opal::Bank> bank = assistant->priv->core->get ("opal-account-store");
+  Opal::Account* account = bank->find_account ("ekiga.net");
 
   if (account && !account->get_username ().empty ())
     gtk_entry_set_text (GTK_ENTRY (assistant->priv->username), account->get_username ().c_str ());
@@ -651,21 +650,15 @@
 static void
 apply_ekiga_net_page (EkigaAssistant *assistant)
 {
-  gmref_ptr<Ekiga::AccountCore> account_core
-    = assistant->priv->core->get ("account-core");
-
-  /* Some specific Opal stuff for the Ekiga.net account */
-  gmref_ptr<Opal::Bank> opal_bank =
-    assistant->priv->core->get ("opal-account-store");
-  Opal::Account* account = dynamic_cast<Opal::Account*>(account_core->find_account ("ekiga.net"));
-
+  gmref_ptr<Opal::Bank> bank = assistant->priv->core->get ("opal-account-store");
+  Opal::Account* account = bank->find_account ("ekiga.net");
   bool new_account = (account == NULL);
 
   if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (assistant->priv->skip_ekiga_net))) {
 	if (new_account)
-	  opal_bank->new_account (Opal::Account::Ekiga,
-							  gtk_entry_get_text (GTK_ENTRY (assistant->priv->username)),
-							  gtk_entry_get_text (GTK_ENTRY (assistant->priv->password)));
+	  bank->new_account (Opal::Account::Ekiga,
+			     gtk_entry_get_text (GTK_ENTRY (assistant->priv->username)),
+			     gtk_entry_get_text (GTK_ENTRY (assistant->priv->password)));
 	else
 	  account->set_authentication_settings (gtk_entry_get_text (GTK_ENTRY (assistant->priv->username)),
 											gtk_entry_get_text (GTK_ENTRY (assistant->priv->password)));
@@ -784,9 +777,8 @@
 static void
 prepare_ekiga_out_page (EkigaAssistant *assistant)
 {
-  gmref_ptr<Ekiga::AccountCore> account_core
-    = assistant->priv->core->get ("account-core");
-  Ekiga::Account *account = account_core->find_account ("sip.diamondcard.us");
+  gmref_ptr<Opal::Bank> account_core = assistant->priv->core->get ("opal-account-store");
+  Opal::Account* account = account_core->find_account ("sip.diamondcard.us");
 
   if (account && !account->get_username ().empty ())
     gtk_entry_set_text (GTK_ENTRY (assistant->priv->dusername), account->get_username ().c_str ());
@@ -802,24 +794,19 @@
 static void
 apply_ekiga_out_page (EkigaAssistant *assistant)
 {
-  gmref_ptr<Ekiga::AccountCore> account_core
-    = assistant->priv->core->get ("account-core");
-
   /* Some specific Opal stuff for the Ekiga.net account */
-  gmref_ptr<Opal::Bank> opal_bank
-    = assistant->priv->core->get ("opal-account-store");
-  Opal::Account* account = dynamic_cast<Opal::Account*> (account_core->find_account ("sip.diamondcard.us"));
-
+  gmref_ptr<Opal::Bank> bank = assistant->priv->core->get ("opal-account-store");
+  Opal::Account* account = bank->find_account ("sip.diamondcard.us");
   bool new_account = (account == NULL);
 
   if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (assistant->priv->skip_ekiga_out))) {
 	if (new_account)
-	  opal_bank->new_account (Opal::Account::DiamondCard,
-							  gtk_entry_get_text (GTK_ENTRY (assistant->priv->dusername)),
-							  gtk_entry_get_text (GTK_ENTRY (assistant->priv->dpassword)));
+	  bank->new_account (Opal::Account::DiamondCard,
+			     gtk_entry_get_text (GTK_ENTRY (assistant->priv->dusername)),
+			     gtk_entry_get_text (GTK_ENTRY (assistant->priv->dpassword)));
 	else
 	  account->set_authentication_settings (gtk_entry_get_text (GTK_ENTRY (assistant->priv->dusername)),
-											gtk_entry_get_text (GTK_ENTRY (assistant->priv->dpassword)));
+						gtk_entry_get_text (GTK_ENTRY (assistant->priv->dpassword)));
   }
 }
 



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