ekiga r7480 - in trunk: . lib/engine/account/skel lib/engine/components/opal src/gui



Author: dsandras
Date: Sat Dec 27 20:08:29 2008
New Revision: 7480
URL: http://svn.gnome.org/viewvc/ekiga?rev=7480&view=rev

Log:
Reverted patch leading Ekiga to crash. Temporary revert.


Modified:
   trunk/ChangeLog
   trunk/lib/engine/account/skel/account-core.cpp
   trunk/lib/engine/account/skel/account-core.h
   trunk/lib/engine/account/skel/bank-impl.h
   trunk/lib/engine/account/skel/bank.h
   trunk/lib/engine/components/opal/opal-bank.cpp
   trunk/lib/engine/components/opal/opal-bank.h
   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/skel/account-core.cpp
==============================================================================
--- trunk/lib/engine/account/skel/account-core.cpp	(original)
+++ trunk/lib/engine/account/skel/account-core.cpp	Sat Dec 27 20:08:29 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);

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	Sat Dec 27 20:08:29 2008
@@ -147,6 +147,14 @@
   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/account/skel/bank-impl.h
==============================================================================
--- trunk/lib/engine/account/skel/bank-impl.h	(original)
+++ trunk/lib/engine/account/skel/bank-impl.h	Sat Dec 27 20:08:29 2008
@@ -101,6 +101,14 @@
      */
     void visit_accounts (sigc::slot1<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 or the host to search 
+     *        for
+     * @return The Account corresponding to the find result
+     *         The returned account should not be freed.
+     */
+    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 ();
@@ -221,6 +229,29 @@
 
 
 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 (aor.find ("@") != std::string::npos) {
+      if (it->get_aor () == aor) {
+        return (&(*it));
+      }
+    }
+    else {
+      if (it->get_host () == aor) {
+        return (&(*it));
+      }
+    }
+  }
+
+  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	Sat Dec 27 20:08:29 2008
@@ -66,6 +66,13 @@
     virtual void visit_accounts (sigc::slot1<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/components/opal/opal-bank.cpp
==============================================================================
--- trunk/lib/engine/components/opal/opal-bank.cpp	(original)
+++ trunk/lib/engine/components/opal/opal-bank.cpp	Sat Dec 27 20:08:29 2008
@@ -127,25 +127,6 @@
     }
 }
 
-Opal::Account*
-Opal::Bank::find_account (const std::string aor)
-{
-  for (iterator it = begin (); it != end (); it++) {
-
-    if (aor.find ("@") != std::string::npos) {
-      if (it->get_aor () == aor) {
-        return (&(*it));
-      }
-    }
-    else {
-      if (it->get_host () == aor) {
-        return (&(*it));
-      }
-    }
-  }
-
-  return NULL;
-}
 
 void Opal::Bank::on_new_account_form_submitted (bool submitted,
 						Ekiga::Form &result,

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 Dec 27 20:08:29 2008
@@ -70,14 +70,6 @@
                       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 Ekiga::Account if an Account was found, false otherwise.
-     *         The returned account should not be freed.
-     */
-    Account* find_account (const std::string aor);
-
 private:
     void on_new_account_form_submitted (bool submitted,
 					Ekiga::Form& form,

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 Dec 27 20:08:29 2008
@@ -45,8 +45,10 @@
 
 #include "sip-endpoint.h"
 
+#include "opal-bank.h"
 #include "opal-call.h"
 
+#include "account-core.h"
 #include "chat-core.h"
 #include "personal-details.h"
 #include "opal-account.h"
@@ -127,9 +129,9 @@
     runtime = &*smart;
   }
   {
-    gmref_ptr<Bank> smart = core.get ("opal-account-store");
+    gmref_ptr<Ekiga::AccountCore> smart = core.get ("account-core");
     smart->reference (); // take a reference in the main thread
-    bank = &*smart;
+    account_core = &*smart;
   }
 
 
@@ -169,7 +171,7 @@
 Opal::Sip::EndPoint::~EndPoint ()
 {
   runtime->unreference (); // leave a reference in the main thread
-  bank->unreference (); // leave a reference in the main thread
+  account_core->unreference (); // leave a reference in the main thread
   dialect->unreference (); // leave a reference in the main thread
 }
 
@@ -205,6 +207,8 @@
 
   if (uri.find ("@") == string::npos) {
 
+    gmref_ptr<Opal::Bank> bank = core.get ("opal-account-store");
+
     if (bank) {
 
       for (Opal::Bank::iterator it = bank->begin ();
@@ -662,7 +666,7 @@
     Subscribe (SIPSubscribe::MessageSummary, 3600, aor);
 
   /* Signal */
-  Account* account = bank->find_account (strm.str ());
+  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,
@@ -895,7 +899,7 @@
   SIPEndPoint::OnRegistrationFailed (strm.str ().c_str (), r, wasRegistering);
 
   /* Signal */
-  Account* account = bank->find_account (strm.str ());
+  Ekiga::Account *account = account_core->find_account (strm.str ());
   if (account)
     runtime->run_in_main (sigc::bind (account->registration_event.make_slot (),
 				      wasRegistering ? Ekiga::AccountCore::RegistrationFailed : Ekiga::AccountCore::UnregistrationFailed,
@@ -911,7 +915,7 @@
     mwi = "0/0";
 
   /* Signal */
-  Account* account = bank->find_account (party);
+  Ekiga::Account *account = account_core->find_account (party);
   if (account)
     runtime->run_in_main (sigc::bind (account->mwi_event.make_slot (), info));
 }
@@ -1023,7 +1027,7 @@
      */
     if (host.GetHostAddress ().GetIpAndPort (address, port) && !manager.IsLocalAddress (address)) {
 
-      Account* account = bank->find_account ("ekiga.net");
+      Ekiga::Account *account = account_core->find_account ("ekiga.net");
 
       if (account)
         return SIPURL ("\"" + GetDefaultDisplayName () + "\" <" + PString(account->get_aor ()) + ">");

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 Dec 27 20:08:29 2008
@@ -44,7 +44,8 @@
 #include "presence-core.h"
 #include "call-manager.h"
 #include "call-protocol-manager.h"
-#include "opal-bank.h"
+#include "account-core.h"
+#include "opal-account.h"
 #include "sip-dialect.h"
 #include "call-core.h"
 #include "contact-core.h"
@@ -181,7 +182,7 @@
       std::list<std::string> aors;               // List of registered aor
       Ekiga::ServiceCore & core;
       Ekiga::Runtime* runtime;
-      Bank* bank;
+      Ekiga::AccountCore* account_core;
 
       Ekiga::CallProtocolManager::Interface listen_iface;
 

Modified: trunk/src/gui/assistant.cpp
==============================================================================
--- trunk/src/gui/assistant.cpp	(original)
+++ trunk/src/gui/assistant.cpp	Sat Dec 27 20:08:29 2008
@@ -633,9 +633,9 @@
 static void
 prepare_ekiga_net_page (EkigaAssistant *assistant)
 {
-  gmref_ptr<Opal::Bank> bank
-    = assistant->priv->core->get ("opal-account-store");
-  Opal::Account* account = bank->find_account ("ekiga.net");
+  gmref_ptr<Ekiga::AccountCore> account_core
+    = assistant->priv->core->get ("account-core");
+  Ekiga::Account *account = account_core->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 +651,24 @@
 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> bank =
+  gmref_ptr<Opal::Bank> opal_bank =
     assistant->priv->core->get ("opal-account-store");
-  Opal::Account* account = bank->find_account ("ekiga.net");
+  Opal::Account* account = dynamic_cast<Opal::Account*>(account_core->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)
-	  bank->new_account (Opal::Account::Ekiga,
-			     gtk_entry_get_text (GTK_ENTRY (assistant->priv->username)),
-			     gtk_entry_get_text (GTK_ENTRY (assistant->priv->password)));
+	  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)));
 	else
 	  account->set_authentication_settings (gtk_entry_get_text (GTK_ENTRY (assistant->priv->username)),
-						gtk_entry_get_text (GTK_ENTRY (assistant->priv->password)));
+											gtk_entry_get_text (GTK_ENTRY (assistant->priv->password)));
   }
 }
 
@@ -781,9 +784,9 @@
 static void
 prepare_ekiga_out_page (EkigaAssistant *assistant)
 {
-  gmref_ptr<Opal::Bank> bank
-    = assistant->priv->core->get ("opal-account-store");
-  Opal::Account* account = bank->find_account ("sip.diamondcard.us");
+  gmref_ptr<Ekiga::AccountCore> account_core
+    = assistant->priv->core->get ("account-core");
+  Ekiga::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 ());
@@ -799,21 +802,24 @@
 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> bank
+  gmref_ptr<Opal::Bank> opal_bank
     = assistant->priv->core->get ("opal-account-store");
-  Opal::Account* account = bank->find_account ("sip.diamondcard.us");
+  Opal::Account* account = dynamic_cast<Opal::Account*> (account_core->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)
-	  bank->new_account (Opal::Account::DiamondCard,
-			     gtk_entry_get_text (GTK_ENTRY (assistant->priv->dusername)),
-			     gtk_entry_get_text (GTK_ENTRY (assistant->priv->dpassword)));
+	  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)));
 	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]