[ekiga/ds-opal-refactoring] Opal: More refactoring. Also use Opal style when dealing with it.



commit e641436d7ef62c956a5e8493b9cff07f6aff2d73
Author: Damien Sandras <dsandras seconix com>
Date:   Sat Mar 21 18:59:59 2015 +0100

    Opal: More refactoring. Also use Opal style when dealing with it.

 lib/engine/components/opal/opal-account.cpp        |    8 ++--
 .../components/opal/process/h323-endpoint.cpp      |   39 ++++----------------
 lib/engine/components/opal/process/h323-endpoint.h |    7 ++--
 .../components/opal/process/sip-endpoint.cpp       |   21 +++++------
 lib/engine/components/opal/process/sip-endpoint.h  |   15 +++-----
 5 files changed, 28 insertions(+), 62 deletions(-)
---
diff --git a/lib/engine/components/opal/opal-account.cpp b/lib/engine/components/opal/opal-account.cpp
index d26b5c2..fa0e328 100644
--- a/lib/engine/components/opal/opal-account.cpp
+++ b/lib/engine/components/opal/opal-account.cpp
@@ -501,7 +501,7 @@ Opal::Account::enable ()
   switch (type) {
   case Account::H323:
     if (h323_endpoint)
-      h323_endpoint->enable_account (*this);
+      h323_endpoint->EnableAccount (*this);
     break;
   case Account::SIP:
   case Account::DiamondCard:
@@ -509,7 +509,7 @@ Opal::Account::enable ()
   default:
     // Register the given aor to the given registrar
     if (sip_endpoint)
-      sip_endpoint->enable_account (*this);
+      sip_endpoint->EnableAccount (*this);
     break;
   }
   updated ();
@@ -529,7 +529,7 @@ Opal::Account::disable ()
   switch (type) {
   case Account::H323:
     if (h323_endpoint)
-      h323_endpoint->disable_account (*this);
+      h323_endpoint->DisableAccount (*this);
     break;
   case Account::SIP:
   case Account::DiamondCard:
@@ -553,7 +553,7 @@ Opal::Account::disable ()
     }
     if (sip_endpoint) {
       // Register the given aor to the given registrar
-      sip_endpoint->disable_account (*this);
+      sip_endpoint->DisableAccount (*this);
     }
     break;
   }
diff --git a/lib/engine/components/opal/process/h323-endpoint.cpp 
b/lib/engine/components/opal/process/h323-endpoint.cpp
index 120f1ef..170ff92 100644
--- a/lib/engine/components/opal/process/h323-endpoint.cpp
+++ b/lib/engine/components/opal/process/h323-endpoint.cpp
@@ -43,13 +43,13 @@ namespace Opal {
 
   namespace H323 {
 
-    class gatekeeper_handler : public PThread
+    class GatekeeperHandler : public PThread
     {
-      PCLASSINFO (gatekeeper_handler, PThread);
+      PCLASSINFO (GatekeeperHandler, PThread);
 
   public:
 
-      gatekeeper_handler (Opal::Account & _account,
+      GatekeeperHandler (Opal::Account & _account,
                           Opal::H323::EndPoint& _ep,
                           bool _registering)
         : PThread (1000, AutoDeleteThread),
@@ -166,31 +166,6 @@ Opal::H323::EndPoint::SetUpCall (const std::string&  uri)
 
 
 bool
-Opal::H323::EndPoint::transfer (const std::string & uri,
-                                bool attended)
-{
-  /* This is not handled yet */
-  if (attended)
-    return false;
-
-  if (GetConnectionCount () == 0)
-      return false;
-
-  /* We don't handle several calls here */
-  for (PSafePtr<OpalConnection> connection(connectionsActive, PSafeReference);
-       connection != NULL;
-       ++connection) {
-    if (!PIsDescendant(&(*connection), OpalPCSSConnection)) {
-      connection->TransferConnection (uri);
-      return true; /* We could handle the transfer */
-    }
-  }
-
-  return false;
-}
-
-
-bool
 Opal::H323::EndPoint::message (G_GNUC_UNUSED const Ekiga::ContactPtr & contact,
                                G_GNUC_UNUSED const std::string & uri)
 {
@@ -226,16 +201,16 @@ Opal::H323::EndPoint::set_initial_bandwidth (unsigned bitrate)
 
 
 void
-Opal::H323::EndPoint::enable_account (Account& account)
+Opal::H323::EndPoint::EnableAccount (Account& account)
 {
-  new gatekeeper_handler (account, *this, true);
+  new GatekeeperHandler (account, *this, true);
 }
 
 
 void
-Opal::H323::EndPoint::disable_account (Account& account)
+Opal::H323::EndPoint::DisableAccount (Account& account)
 {
-  new gatekeeper_handler (account, *this, false);
+  new GatekeeperHandler (account, *this, false);
 }
 
 
diff --git a/lib/engine/components/opal/process/h323-endpoint.h 
b/lib/engine/components/opal/process/h323-endpoint.h
index 34f7677..d1d9fe6 100644
--- a/lib/engine/components/opal/process/h323-endpoint.h
+++ b/lib/engine/components/opal/process/h323-endpoint.h
@@ -68,8 +68,7 @@ namespace Opal {
       ~EndPoint ();
 
       bool SetUpCall (const std::string & uri);
-      bool transfer (const std::string & uri,
-                     bool attended);
+
       bool message (const Ekiga::ContactPtr & contact,
                     const std::string & uri);
 
@@ -82,8 +81,8 @@ namespace Opal {
        * will be updated to reflect the current account state once
        * the operation has been successful.
        */
-      void enable_account (Account & account);
-      void disable_account (Account & account);
+      void EnableAccount (Account & account);
+      void DisableAccount (Account & account);
 
       bool UseGatekeeper (const PString & address = PString::Empty (),
                           const PString & domain = PString::Empty (),
diff --git a/lib/engine/components/opal/process/sip-endpoint.cpp 
b/lib/engine/components/opal/process/sip-endpoint.cpp
index faf5518..cdb58cb 100644
--- a/lib/engine/components/opal/process/sip-endpoint.cpp
+++ b/lib/engine/components/opal/process/sip-endpoint.cpp
@@ -44,15 +44,15 @@ namespace Opal {
 
   namespace Sip {
 
-    class registrar_handler : public PThread
+    class RegistrarHandler : public PThread
     {
-      PCLASSINFO (registrar_handler, PThread);
+      PCLASSINFO (RegistrarHandler, PThread);
 
   public:
 
-      registrar_handler (Opal::Account & _account,
-                         Opal::Sip::EndPoint& _ep,
-                         bool _registering)
+      RegistrarHandler (Opal::Account & _account,
+                        Opal::Sip::EndPoint& _ep,
+                        bool _registering)
         : PThread (1000, AutoDeleteThread),
         account (_account),
         ep (_ep),
@@ -110,9 +110,6 @@ Opal::Sip::EndPoint::EndPoint (Opal::EndPoint & _endpoint,
                                const Ekiga::ServiceCore& _core): SIPEndPoint (_endpoint),
                                                                  core (_core)
 {
-  boost::shared_ptr<Ekiga::ChatCore> chat_core = core.get<Ekiga::ChatCore> ("chat-core");
-  boost::shared_ptr<Ekiga::PresenceCore> presence_core = core.get<Ekiga::PresenceCore> ("presence-core");
-
   /* Timeouts */
   SetAckTimeout (PTimeInterval (0, 32));
   SetPduCleanUpTimeout (PTimeInterval (0, 1));
@@ -233,16 +230,16 @@ Opal::Sip::EndPoint::StartListener (unsigned port)
 
 
 void
-Opal::Sip::EndPoint::enable_account (Account & account)
+Opal::Sip::EndPoint::EnableAccount (Account & account)
 {
-  new registrar_handler (account, *this, true);
+  new RegistrarHandler (account, *this, true);
 }
 
 
 void
-Opal::Sip::EndPoint::disable_account (Account & account)
+Opal::Sip::EndPoint::DisableAccount (Account & account)
 {
-  new registrar_handler (account, *this, false);
+  new RegistrarHandler (account, *this, false);
 }
 
 
diff --git a/lib/engine/components/opal/process/sip-endpoint.h 
b/lib/engine/components/opal/process/sip-endpoint.h
index 58f0ed2..908cfb4 100644
--- a/lib/engine/components/opal/process/sip-endpoint.h
+++ b/lib/engine/components/opal/process/sip-endpoint.h
@@ -76,9 +76,7 @@ namespace Opal {
 
       bool StartListener (unsigned port);
 
-      void set_outbound_proxy (const std::string & uri);
-      const std::string & get_outbound_proxy () const;
-
+      //
       // a message waiting information was received
       // the parameters are the aor and the info
       boost::signals2::signal<void(std::string, std::string)> mwi_event;
@@ -87,9 +85,11 @@ namespace Opal {
        * will be updated to reflect the current account state once
        * the operation has been successful.
        */
-      void enable_account (Account & account);
-      void disable_account (Account & account);
+      void EnableAccount (Account & account);
+
+      void DisableAccount (Account & account);
 
+    private:
       /* OPAL Methods */
       void OnRegistrationStatus (const RegistrationStatus & status);
 
@@ -108,11 +108,6 @@ namespace Opal {
       void OnMESSAGECompleted (const SIPMessage::Params & params,
                                SIP_PDU::StatusCodes reason);
 
-
-      /* Callbacks */
-    private:
-      std::string outbound_proxy;
-
       const Ekiga::ServiceCore & core;
     };
   };


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