[ekiga/ds-opal-refactoring] Opal: Trigger Account setup when the Opal::EndPoint is ready.



commit 7814761e20697d5dda4e93b4d204b66569575265
Author: Damien Sandras <dsandras seconix com>
Date:   Sun Mar 22 10:15:40 2015 +0100

    Opal: Trigger Account setup when the Opal::EndPoint is ready.
    
    This was temporarily removed.

 lib/engine/components/opal/opal-main.cpp           |   43 +++++++++++++++-----
 .../components/opal/process/h323-endpoint.cpp      |    4 +-
 .../components/opal/process/opal-endpoint.cpp      |    6 +-
 lib/engine/components/opal/process/opal-endpoint.h |    1 +
 .../components/opal/process/sip-endpoint.cpp       |    3 -
 lib/engine/protocol/call-manager.h                 |    6 ---
 6 files changed, 37 insertions(+), 26 deletions(-)
---
diff --git a/lib/engine/components/opal/opal-main.cpp b/lib/engine/components/opal/opal-main.cpp
index 3c48fde..1a2456c 100644
--- a/lib/engine/components/opal/opal-main.cpp
+++ b/lib/engine/components/opal/opal-main.cpp
@@ -60,11 +60,34 @@
  */
 using namespace Opal;
 
-struct OPALSpark: public Ekiga::Spark
+class OPALSpark: public Ekiga::Spark
 {
+public:
   OPALSpark (): result(false)
   {}
 
+
+  void on_ready (Ekiga::ServiceCore& core,
+#ifdef HAVE_H323
+                 Opal::H323::EndPoint& h323_endpoint,
+#endif
+                 Opal::Sip::EndPoint& sip_endpoint)
+  {
+      boost::shared_ptr<Ekiga::PresenceCore> presence_core = core.get<Ekiga::PresenceCore> ("presence-core");
+      boost::shared_ptr<Ekiga::AccountCore> account_core = core.get<Ekiga::AccountCore> ("account-core");
+      boost::shared_ptr<Opal::Bank> bank = boost::shared_ptr<Opal::Bank> (new Opal::Bank (core,
+#ifdef HAVE_H323
+                                                                                          &h323_endpoint,
+#endif
+                                                                                          &sip_endpoint));
+
+      account_core->add_bank (bank);
+      presence_core->add_cluster (bank);
+      core.add (bank);
+      presence_core->add_presence_publisher (bank);
+  }
+
+
   bool try_initialize_more (Ekiga::ServiceCore& core,
                            int* /*argc*/,
                            char** /*argv*/[])
@@ -104,17 +127,13 @@ struct OPALSpark: public Ekiga::Spark
       call_core->add_manager (h323_call_manager);
 #endif
 
-      std::cout << "FIXME HERE" << std::endl;
-      boost::shared_ptr<Opal::Bank> bank = boost::shared_ptr<Opal::Bank> (new Opal::Bank (core,
+      // We create the Bank
+      endpoint.ready.connect (boost::bind (&OPALSpark::on_ready, this,
+                                           boost::ref (core),
 #ifdef HAVE_H323
-                                                                                          &h323_endpoint,
+                                           boost::ref (h323_endpoint),
 #endif
-                                                                                          &sip_endpoint));
-
-      account_core->add_bank (bank);
-      presence_core->add_cluster (bank);
-      core.add (bank);
-      presence_core->add_presence_publisher (bank);
+                                           boost::ref (sip_endpoint)));
 
       result = true;
     }
@@ -131,6 +150,7 @@ struct OPALSpark: public Ekiga::Spark
   bool result;
 };
 
+
 GnomeMeeting &
 opal_init_pprocess (int argc,
                     char *argv [])
@@ -181,9 +201,10 @@ opal_init_pprocess (int argc,
   return instance;
 }
 
+
 void
 opal_init (Ekiga::KickStart& kickstart)
 {
-  boost::shared_ptr<Ekiga::Spark> spark(new OPALSpark);
+  boost::shared_ptr<Ekiga::Spark> spark (new OPALSpark);
   kickstart.add_spark (spark);
 }
diff --git a/lib/engine/components/opal/process/h323-endpoint.cpp 
b/lib/engine/components/opal/process/h323-endpoint.cpp
index 299359e..f7fba12 100644
--- a/lib/engine/components/opal/process/h323-endpoint.cpp
+++ b/lib/engine/components/opal/process/h323-endpoint.cpp
@@ -145,11 +145,9 @@ Opal::H323::EndPoint::EndPoint (Opal::EndPoint & _endpoint,
   /* Ready to take calls */
   GetManager ().AddRouteEntry("h323:.* = pc:*");
   GetManager ().AddRouteEntry("pc:.* = h323:<da>");
-
-  std::cout << "FIXME" << std::endl;
-//  manager.ready.connect (boost::bind (&EndPoint::setup, this, ""));
 }
 
+
 Opal::H323::EndPoint::~EndPoint ()
 {
 }
diff --git a/lib/engine/components/opal/process/opal-endpoint.cpp 
b/lib/engine/components/opal/process/opal-endpoint.cpp
index 7de5fe4..8bae5c7 100644
--- a/lib/engine/components/opal/process/opal-endpoint.cpp
+++ b/lib/engine/components/opal/process/opal-endpoint.cpp
@@ -426,7 +426,7 @@ void Opal::EndPoint::set_stun_enabled (bool enabled)
     Ekiga::Runtime::run_in_main (boost::bind (&Opal::EndPoint::HandleSTUNResult, this), 1);
   }
   else {
-    //ready ();
+    ready ();
   }
 
   PTRACE (4, "Opal::EndPoint\tSTUN Detection: " << enabled);
@@ -696,7 +696,7 @@ Opal::EndPoint::HandleSTUNResult ()
     }
     else {
 
-      //ready ();
+      ready ();
     }
   }
   else if (patience == 0) {
@@ -710,7 +710,7 @@ Opal::EndPoint::HandleSTUNResult ()
                       " still use it, but you need to configure your network settings manually.\n\n"
                       "Please see http://wiki.ekiga.org/index.php/Enable_port_forwarding_manually for"
                       " instructions"));
-    //ready ();
+    ready ();
   }
   else if (!got_answer) {
 
diff --git a/lib/engine/components/opal/process/opal-endpoint.h 
b/lib/engine/components/opal/process/opal-endpoint.h
index e8530f9..0986b4e 100644
--- a/lib/engine/components/opal/process/opal-endpoint.h
+++ b/lib/engine/components/opal/process/opal-endpoint.h
@@ -153,6 +153,7 @@ public:
     void GetVideoOptions (VideoOptions & options) const;
 
     boost::signals2::signal<void(Opal::Call *)> created_call;
+    boost::signals2::signal<void(void)> ready;
 
 private:
     boost::weak_ptr<Ekiga::CallCore> call_core;
diff --git a/lib/engine/components/opal/process/sip-endpoint.cpp 
b/lib/engine/components/opal/process/sip-endpoint.cpp
index cdb58cb..b077e59 100644
--- a/lib/engine/components/opal/process/sip-endpoint.cpp
+++ b/lib/engine/components/opal/process/sip-endpoint.cpp
@@ -130,9 +130,6 @@ Opal::Sip::EndPoint::EndPoint (Opal::EndPoint & _endpoint,
   KeepAliveType type;
   GetKeepAlive (timeout, type);
   SetKeepAlive (timeout, KeepAliveByOPTION);
-
-  std::cout << "FIXME" << std::endl;
-  //manager.ready.connect (boost::bind (&EndPoint::setup, this, ""));
 }
 
 
diff --git a/lib/engine/protocol/call-manager.h b/lib/engine/protocol/call-manager.h
index 4e10ad8..9d1b7e8 100644
--- a/lib/engine/protocol/call-manager.h
+++ b/lib/engine/protocol/call-manager.h
@@ -218,12 +218,6 @@ namespace Ekiga
      * @return the maximum jitter for calls in seconds.
      */
     virtual unsigned get_maximum_jitter () const = 0;
-
-
-    /*
-     * MISC
-     */
-    boost::signals2::signal<void(void)> ready;
   };
 
   /**


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