ekiga r6348 - in trunk: . src/endpoints



Author: dsandras
Date: Mon Jun  2 20:35:45 2008
New Revision: 6348
URL: http://svn.gnome.org/viewvc/ekiga?rev=6348&view=rev

Log:
Better naming scheme matchin the engine naming conventions for the old
GMSIPEndpoint and H323Endpoint classes.


Modified:
   trunk/ChangeLog
   trunk/src/endpoints/accountshandler.cpp
   trunk/src/endpoints/h323.cpp
   trunk/src/endpoints/h323.h
   trunk/src/endpoints/opal-gmconf-bridge.cpp
   trunk/src/endpoints/opal-main.cpp
   trunk/src/endpoints/sip.cpp
   trunk/src/endpoints/sip.h

Modified: trunk/src/endpoints/accountshandler.cpp
==============================================================================
--- trunk/src/endpoints/accountshandler.cpp	(original)
+++ trunk/src/endpoints/accountshandler.cpp	Mon Jun  2 20:35:45 2008
@@ -155,7 +155,7 @@
 void GMAccountsEndpoint::SIPRegister (GmAccount *a)
 {
   std::string aor;
-  GMSIPEndpoint *sip_manager = dynamic_cast<GMSIPEndpoint *> (ep.get_protocol_manager ("sip"));
+  OpalSip::CallProtocolManager *sip_manager = dynamic_cast<OpalSip::CallProtocolManager *> (ep.get_protocol_manager ("sip"));
 
   // TODO Move this to the engine and drop the dynamic cast
   aor = a->username;
@@ -170,7 +170,7 @@
 void GMAccountsEndpoint::H323Register (GmAccount *a)
 {
   std::string aor;
-  GMH323Endpoint *h323_manager = dynamic_cast<GMH323Endpoint *> (ep.get_protocol_manager ("h323"));
+  OpalH323::CallProtocolManager *h323_manager = dynamic_cast<OpalH323::CallProtocolManager *> (ep.get_protocol_manager ("h323"));
 
   // TODO Move this to the engine and drop the dynamic cast
   aor = a->username;

Modified: trunk/src/endpoints/h323.cpp
==============================================================================
--- trunk/src/endpoints/h323.cpp	(original)
+++ trunk/src/endpoints/h323.cpp	Mon Jun  2 20:35:45 2008
@@ -70,11 +70,11 @@
 
 
 /* The class */
-GMH323Endpoint::GMH323Endpoint (GMManager & ep, Ekiga::ServiceCore & _core, unsigned _listen_port)
-: H323EndPoint (ep), 
-  endpoint (ep),
-  core (_core),
-  runtime (*(dynamic_cast<Ekiga::Runtime *> (core.get ("runtime"))))
+OpalH323::CallProtocolManager::CallProtocolManager (GMManager & ep, Ekiga::ServiceCore & _core, unsigned _listen_port)
+         : H323EndPoint (ep), 
+           endpoint (ep),
+           core (_core),
+           runtime (*(dynamic_cast<Ekiga::Runtime *> (core.get ("runtime"))))
 {
   protocol_name = "h323";
   uri_prefix = "h323:";
@@ -92,7 +92,7 @@
 }
 
 
-bool GMH323Endpoint::populate_menu (Ekiga::Contact &contact,
+bool OpalH323::CallProtocolManager::populate_menu (Ekiga::Contact &contact,
                                    Ekiga::MenuBuilder &builder)
 {
   std::string name = contact.get_name ();
@@ -102,7 +102,7 @@
 }
 
 
-bool GMH323Endpoint::populate_menu (const std::string uri,
+bool OpalH323::CallProtocolManager::populate_menu (const std::string uri,
                                    Ekiga::MenuBuilder & builder)
 {
   std::map<std::string, std::string> uris; 
@@ -112,7 +112,7 @@
 }
 
 
-bool GMH323Endpoint::menu_builder_add_actions (const std::string & /*fullname*/,
+bool OpalH323::CallProtocolManager::menu_builder_add_actions (const std::string & /*fullname*/,
                                               std::map<std::string,std::string> & uris,
                                               Ekiga::MenuBuilder & builder)
 {
@@ -128,7 +128,7 @@
     if (!iter->first.empty ())
       action = action + " [" + iter->first + "]";
 
-    builder.add_action ("call", action, sigc::bind (sigc::mem_fun (this, &GMH323Endpoint::on_dial), iter->second));
+    builder.add_action ("call", action, sigc::bind (sigc::mem_fun (this, &OpalH323::CallProtocolManager::on_dial), iter->second));
 
     populated = true;
   }
@@ -137,7 +137,7 @@
 }
 
 
-bool GMH323Endpoint::dial (const std::string & uri)
+bool OpalH323::CallProtocolManager::dial (const std::string & uri)
 {
   PString token;
   std::stringstream ustr;
@@ -153,13 +153,13 @@
 }
 
 
-const std::string & GMH323Endpoint::get_protocol_name () const
+const std::string & OpalH323::CallProtocolManager::get_protocol_name () const
 {
   return protocol_name;
 }
 
 
-void GMH323Endpoint::set_dtmf_mode (unsigned mode)
+void OpalH323::CallProtocolManager::set_dtmf_mode (unsigned mode)
 {
   switch (mode) 
     {
@@ -181,7 +181,7 @@
 }
 
 
-unsigned GMH323Endpoint::get_dtmf_mode () const
+unsigned OpalH323::CallProtocolManager::get_dtmf_mode () const
 {
   if (GetSendUserInputMode () == OpalConnection::SendUserInputAsString)
     return 0;
@@ -199,7 +199,7 @@
 }
 
 
-bool GMH323Endpoint::set_listen_port (unsigned port)
+bool OpalH323::CallProtocolManager::set_listen_port (unsigned port)
 {
   interface.protocol = "tcp";
   interface.interface = "*";
@@ -221,26 +221,26 @@
 }
 
 
-const Ekiga::CallProtocolManager::Interface & GMH323Endpoint::get_listen_interface () const
+const Ekiga::CallProtocolManager::Interface & OpalH323::CallProtocolManager::get_listen_interface () const
 {
   return interface;
 }
 
 
-void GMH323Endpoint::set_forward_uri (const std::string & uri)
+void OpalH323::CallProtocolManager::set_forward_uri (const std::string & uri)
 {
   forward_uri = uri;
 }
 
 
-const std::string & GMH323Endpoint::get_forward_uri () const
+const std::string & OpalH323::CallProtocolManager::get_forward_uri () const
 {
   return forward_uri;
 }
 
 
 void
-GMH323Endpoint::Register (const PString & aor,
+OpalH323::CallProtocolManager::Register (const PString & aor,
                           const PString & authUserName,
                           const PString & password,
                           const PString & gatekeeperID,
@@ -341,7 +341,7 @@
 
 
 bool 
-GMH323Endpoint::UseGatekeeper (const PString & address,
+OpalH323::CallProtocolManager::UseGatekeeper (const PString & address,
 			       const PString & domain,
 			       const PString & iface)
 {
@@ -357,7 +357,7 @@
   
 
 bool 
-GMH323Endpoint::RemoveGatekeeper (const PString & address)
+OpalH323::CallProtocolManager::RemoveGatekeeper (const PString & address)
 {
   if (IsRegisteredWithGatekeeper (address))
     return H323EndPoint::RemoveGatekeeper (0);
@@ -367,7 +367,7 @@
   
   
 bool 
-GMH323Endpoint::IsRegisteredWithGatekeeper (const PString & address)
+OpalH323::CallProtocolManager::IsRegisteredWithGatekeeper (const PString & address)
 {
   PWaitAndSignal m(gk_name_mutex);
   
@@ -376,11 +376,11 @@
 
 
 bool 
-GMH323Endpoint::OnIncomingConnection (OpalConnection & connection,
+OpalH323::CallProtocolManager::OnIncomingConnection (OpalConnection & connection,
                                       G_GNUC_UNUSED unsigned options,
                                       G_GNUC_UNUSED OpalConnection::StringOptions *stroptions)
 {
-  PTRACE (3, "GMH323Endpoint\tIncoming connection");
+  PTRACE (3, "OpalH323::CallProtocolManager\tIncoming connection");
 
   if (!forward_uri.empty () && endpoint.get_unconditional_forward ())
     connection.ForwardCall (forward_uri);
@@ -410,7 +410,7 @@
 }
 
 
-void GMH323Endpoint::on_dial (std::string uri)
+void OpalH323::CallProtocolManager::on_dial (std::string uri)
 {
   endpoint.dial (uri);
 }

Modified: trunk/src/endpoints/h323.h
==============================================================================
--- trunk/src/endpoints/h323.h	(original)
+++ trunk/src/endpoints/h323.h	Mon Jun  2 20:35:45 2008
@@ -39,7 +39,6 @@
 #ifndef _H323_ENDPOINT_H_
 #define _H323_ENDPOINT_H_
 
-
 #include "config.h"
 
 #include "common.h"
@@ -47,87 +46,86 @@
 #include "manager.h"
 
 
-/* Minimal H.323 endpoint implementation */
-class GMH323Endpoint : 
-    public H323EndPoint,
-    public Ekiga::CallProtocolManager,
-    public Ekiga::PresentityDecorator,
-    public Ekiga::ContactDecorator
-{
-  PCLASSINFO(GMH323Endpoint, H323EndPoint);
+namespace OpalH323 {
 
- public:
+  class CallProtocolManager : public H323EndPoint,
+                              public Ekiga::CallProtocolManager,
+                              public Ekiga::PresentityDecorator,
+                              public Ekiga::ContactDecorator
+  {
+    PCLASSINFO(CallProtocolManager, H323EndPoint);
 
-  GMH323Endpoint (GMManager &ep, Ekiga::ServiceCore & core, unsigned listen_port);
+public:
+    CallProtocolManager (GMManager &ep, Ekiga::ServiceCore & core, unsigned listen_port);
 
 
-  /* ContactDecorator and PresentityDecorator */
-  bool populate_menu (Ekiga::Contact &contact,
-                      Ekiga::MenuBuilder &builder);
+    /* ContactDecorator and PresentityDecorator */
+    bool populate_menu (Ekiga::Contact &contact,
+                        Ekiga::MenuBuilder &builder);
 
-  bool populate_menu (const std::string uri,
-                      Ekiga::MenuBuilder & builder);
+    bool populate_menu (const std::string uri,
+                        Ekiga::MenuBuilder & builder);
 
-  bool menu_builder_add_actions (const std::string & fullname,
-                                 std::map<std::string, std::string> & uris,
-                                 Ekiga::MenuBuilder & builder);
+    bool menu_builder_add_actions (const std::string & fullname,
+                                   std::map<std::string, std::string> & uris,
+                                   Ekiga::MenuBuilder & builder);
 
 
-  /* CallProtocolManager */
-  bool dial (const std::string & uri); 
+    /* CallProtocolManager */
+    bool dial (const std::string & uri); 
 
-  const std::string & get_protocol_name () const;
+    const std::string & get_protocol_name () const;
 
-  void set_dtmf_mode (unsigned mode);
-  unsigned get_dtmf_mode () const;
+    void set_dtmf_mode (unsigned mode);
+    unsigned get_dtmf_mode () const;
 
-  bool set_listen_port (unsigned port);
-  const Ekiga::CallProtocolManager::Interface & get_listen_interface () const;
+    bool set_listen_port (unsigned port);
+    const Ekiga::CallProtocolManager::Interface & get_listen_interface () const;
 
 
-  /* H.323 CallProtocolManager */
-  void set_forward_uri (const std::string & uri);
-  const std::string & get_forward_uri () const;
+    /* H.323 CallProtocolManager */
+    void set_forward_uri (const std::string & uri);
+    const std::string & get_forward_uri () const;
 
 
-  /* OPAL methods */
-  void Register (const PString & aor,
-                 const PString & authUserName,
-                 const PString & password,
-                 const PString & gatekeeperID,
-                 unsigned int expires,
-                 bool unregister);
+    /* OPAL methods */
+    void Register (const PString & aor,
+                   const PString & authUserName,
+                   const PString & password,
+                   const PString & gatekeeperID,
+                   unsigned int expires,
+                   bool unregister);
 
-  bool UseGatekeeper (const PString & address = PString::Empty (),
-		      const PString & domain = PString::Empty (),
-		      const PString & iface = PString::Empty ());
-  
-  bool RemoveGatekeeper (const PString & address);
-  
-  bool IsRegisteredWithGatekeeper (const PString & address);
-  
-  bool OnIncomingConnection (OpalConnection &connection,
-                             unsigned options,
-                             OpalConnection::StringOptions *str_options);
+    bool UseGatekeeper (const PString & address = PString::Empty (),
+                        const PString & domain = PString::Empty (),
+                        const PString & iface = PString::Empty ());
 
+    bool RemoveGatekeeper (const PString & address);
 
- private:
-  void on_dial (std::string uri);
+    bool IsRegisteredWithGatekeeper (const PString & address);
 
-  GMManager & endpoint;
-  Ekiga::ServiceCore & core;
-  Ekiga::Runtime & runtime;
+    bool OnIncomingConnection (OpalConnection &connection,
+                               unsigned options,
+                               OpalConnection::StringOptions *str_options);
 
-  PMutex gk_name_mutex;
-  PString gk_name;
 
-  Ekiga::CallProtocolManager::Interface interface;
+private:
+    void on_dial (std::string uri);
 
-  std::string protocol_name;
-  std::string uri_prefix;
-  std::string forward_uri;
+    GMManager & endpoint;
+    Ekiga::ServiceCore & core;
+    Ekiga::Runtime & runtime;
 
-  unsigned listen_port;
-};
+    PMutex gk_name_mutex;
+    PString gk_name;
+
+    Ekiga::CallProtocolManager::Interface interface;
 
+    std::string protocol_name;
+    std::string uri_prefix;
+    std::string forward_uri;
+
+    unsigned listen_port;
+  };
+};
 #endif

Modified: trunk/src/endpoints/opal-gmconf-bridge.cpp
==============================================================================
--- trunk/src/endpoints/opal-gmconf-bridge.cpp	(original)
+++ trunk/src/endpoints/opal-gmconf-bridge.cpp	Mon Jun  2 20:35:45 2008
@@ -226,7 +226,7 @@
   // 
   else if (key.find (SIP_KEY) != string::npos) {
 
-    GMSIPEndpoint *sip_manager = dynamic_cast<GMSIPEndpoint *> (manager.get_protocol_manager ("sip"));
+    OpalSip::CallProtocolManager *sip_manager = dynamic_cast<OpalSip::CallProtocolManager *> (manager.get_protocol_manager ("sip"));
     if (sip_manager) {
 
       if (key == SIP_KEY "outbound_proxy_host") {
@@ -257,7 +257,7 @@
   //
   else if (key.find (SIP_KEY) != string::npos) {
 
-    GMH323Endpoint *h323_manager = dynamic_cast<GMH323Endpoint *> (manager.get_protocol_manager ("h323"));
+    OpalH323::CallProtocolManager *h323_manager = dynamic_cast<OpalH323::CallProtocolManager *> (manager.get_protocol_manager ("h323"));
     if (h323_manager) {
 
       if (key == H323_KEY "enable_h245_tunneling") {

Modified: trunk/src/endpoints/opal-main.cpp
==============================================================================
--- trunk/src/endpoints/opal-main.cpp	(original)
+++ trunk/src/endpoints/opal-main.cpp	Mon Jun  2 20:35:45 2008
@@ -74,33 +74,33 @@
   call_core = dynamic_cast<Ekiga::CallCore *> (core.get ("call-core"));
   chat_core = dynamic_cast<Ekiga::ChatCore *> (core.get ("chat-core"));
 
-  GMManager *manager = new GMManager (core);
-  GMSIPEndpoint *sipEP = new GMSIPEndpoint (*manager, core, sip_port);
-  GMH323Endpoint *h323EP = new GMH323Endpoint (*manager, core, h323_port);
-
-  manager->add_protocol_manager (*sipEP);
-  manager->add_protocol_manager (*h323EP);
-
-  call_core->add_manager (*manager);
-  core.add (*manager); // FIXME temporary
-  chat_core->add_manager (*sipEP);
+  GMManager *call_manager = new GMManager (core);
+  OpalSip::CallProtocolManager *sip_manager = new OpalSip::CallProtocolManager (*call_manager, core, sip_port);
+  OpalH323::CallProtocolManager *h323_manager = new OpalH323::CallProtocolManager (*call_manager, core, h323_port);
+
+  call_manager->add_protocol_manager (*sip_manager);
+  call_manager->add_protocol_manager (*h323_manager);
+
+  call_core->add_manager (*call_manager);
+  core.add (*call_manager); // FIXME temporary
+  chat_core->add_manager (*sip_manager);
 
-  new Opal::ConfBridge (*manager);
-  manager->start ();
+  new Opal::ConfBridge (*call_manager);
+  call_manager->start ();
   // FIXME Service ?
 
   if (contact_core != NULL) 
-    contact_core->add_contact_decorator (*sipEP);
+    contact_core->add_contact_decorator (*sip_manager);
   else
     return false;
 
   if (presence_core != NULL) {
 
-    presence_core->add_presentity_decorator (*sipEP);
+    presence_core->add_presentity_decorator (*sip_manager);
     presence_core->add_supported_uri (sigc::ptr_fun (is_sip_address));
 
-    presence_core->add_presence_fetcher (*sipEP);
-    presence_core->add_presence_publisher (*sipEP);
+    presence_core->add_presence_fetcher (*sip_manager);
+    presence_core->add_presence_publisher (*sip_manager);
   }
   else 
     return false;

Modified: trunk/src/endpoints/sip.cpp
==============================================================================
--- trunk/src/endpoints/sip.cpp	(original)
+++ trunk/src/endpoints/sip.cpp	Mon Jun  2 20:35:45 2008
@@ -56,17 +56,17 @@
 
   dialer (const std::string & uri, GMManager & ep) 
     : PThread (1000, AutoDeleteThread), 
-      dial_uri (uri),
-      endpoint (ep) 
+    dial_uri (uri),
+    endpoint (ep) 
   {
     this->Resume ();
   };
-  
+
   void Main () 
-  {
-    PString token;
-    endpoint.SetUpCall ("pc:*", dial_uri, token);
-  };
+    {
+      PString token;
+      endpoint.SetUpCall ("pc:*", dial_uri, token);
+    };
 
 private:
   const std::string dial_uri;
@@ -75,13 +75,15 @@
 
 
 /* The class */
-GMSIPEndpoint::GMSIPEndpoint (GMManager & ep, Ekiga::ServiceCore & _core, unsigned _listen_port)
-: SIPEndPoint (ep), 
-  Ekiga::PresencePublisher (_core), 
-  endpoint (ep), 
-  core (_core),
-  presence_core (*(dynamic_cast<Ekiga::PresenceCore *> (core.get ("presence-core")))),
-  runtime (*(dynamic_cast<Ekiga::Runtime *> (core.get ("runtime"))))
+OpalSip::CallProtocolManager::CallProtocolManager (GMManager & ep, 
+                                                   Ekiga::ServiceCore & _core, 
+                                                   unsigned _listen_port)
+        : SIPEndPoint (ep), 
+          Ekiga::PresencePublisher (_core), 
+          endpoint (ep), 
+          core (_core),
+          presence_core (*(dynamic_cast<Ekiga::PresenceCore *> (core.get ("presence-core")))),
+          runtime (*(dynamic_cast<Ekiga::Runtime *> (core.get ("runtime"))))
 {
   protocol_name = "sip";
   uri_prefix = "sip:";
@@ -94,7 +96,7 @@
   SetNonInviteTimeout (PTimeInterval (0, 6));
   SetRetryTimeouts (500, 4000);
   SetMaxRetries (8);
-  
+
   /* Start listener */
   set_listen_port (listen_port);
 
@@ -114,8 +116,8 @@
 }
 
 
-bool GMSIPEndpoint::populate_menu (Ekiga::Contact &contact,
-                                   Ekiga::MenuBuilder &builder)
+bool OpalSip::CallProtocolManager::populate_menu (Ekiga::Contact &contact,
+                                                  Ekiga::MenuBuilder &builder)
 {
   std::string name = contact.get_name ();
   std::map<std::string, std::string> uris = contact.get_uris ();
@@ -124,8 +126,8 @@
 }
 
 
-bool GMSIPEndpoint::populate_menu (const std::string uri,
-                                   Ekiga::MenuBuilder & builder)
+bool OpalSip::CallProtocolManager::populate_menu (const std::string uri,
+                                                  Ekiga::MenuBuilder & builder)
 {
   std::map<std::string, std::string> uris; 
   uris [""] = uri;
@@ -134,9 +136,9 @@
 }
 
 
-bool GMSIPEndpoint::menu_builder_add_actions (const std::string & fullname,
-                                              std::map<std::string,std::string> & uris,
-                                              Ekiga::MenuBuilder & builder)
+bool OpalSip::CallProtocolManager::menu_builder_add_actions (const std::string & fullname,
+                                                             std::map<std::string,std::string> & uris,
+                                                             Ekiga::MenuBuilder & builder)
 {
   bool populated = false;
 
@@ -150,7 +152,7 @@
     if (!iter->first.empty ())
       action = action + " [" + iter->first + "]";
 
-    builder.add_action ("call", action, sigc::bind (sigc::mem_fun (this, &GMSIPEndpoint::on_dial), iter->second));
+    builder.add_action ("call", action, sigc::bind (sigc::mem_fun (this, &OpalSip::CallProtocolManager::on_dial), iter->second));
 
     populated = true;
   }
@@ -165,7 +167,7 @@
     if (!iter->first.empty ())
       action = action + " [" + iter->first + "]";
 
-    builder.add_action ("message", action, sigc::bind (sigc::mem_fun (this, &GMSIPEndpoint::on_message), fullname, iter->second));
+    builder.add_action ("message", action, sigc::bind (sigc::mem_fun (this, &OpalSip::CallProtocolManager::on_message), fullname, iter->second));
 
     populated = true;
   }
@@ -174,8 +176,7 @@
 }
 
 
-void
-GMSIPEndpoint::fetch (const std::string _uri)
+void OpalSip::CallProtocolManager::fetch (const std::string _uri)
 {
   std::string::size_type loc = _uri.find ("@", 0);
   std::string domain;
@@ -195,8 +196,7 @@
 }
 
 
-void
-GMSIPEndpoint::unfetch (const std::string uri)
+void OpalSip::CallProtocolManager::unfetch (const std::string uri)
 {
   if (IsSubscribed (SIPSubscribe::Presence, uri.c_str ())) {
 
@@ -208,8 +208,7 @@
 }
 
 
-void 
-GMSIPEndpoint::publish (const Ekiga::PersonalDetails & details)
+void OpalSip::CallProtocolManager::publish (const Ekiga::PersonalDetails & details)
 {
   std::string hostname = (const char *) PIPSocket::GetHostName ();
   std::string short_status = ((Ekiga::PersonalDetails &) (details)).get_short_status ();
@@ -257,8 +256,8 @@
 }
 
 
-bool GMSIPEndpoint::send_message (const std::string & _uri, 
-                                  const std::string & _message)
+bool OpalSip::CallProtocolManager::send_message (const std::string & _uri, 
+                                                 const std::string & _message)
 {
   if (!_uri.empty () && (_uri.find ("sip:") == 0 || _uri.find (':') == string::npos) && !_message.empty ()) {
 
@@ -273,7 +272,7 @@
 }
 
 
-bool GMSIPEndpoint::dial (const std::string & uri)
+bool OpalSip::CallProtocolManager::dial (const std::string & uri)
 {
   PString token;
   std::stringstream ustr;
@@ -294,32 +293,32 @@
 }
 
 
-const std::string & GMSIPEndpoint::get_protocol_name () const
+const std::string & OpalSip::CallProtocolManager::get_protocol_name () const
 {
   return protocol_name;
 }
 
 
-void GMSIPEndpoint::set_dtmf_mode (unsigned mode)
+void OpalSip::CallProtocolManager::set_dtmf_mode (unsigned mode)
 {
   switch (mode) {
-    
+
     // SIP Info
-    case 0:
-      SetSendUserInputMode (OpalConnection::SendUserInputAsTone);
-      break;
+  case 0:
+    SetSendUserInputMode (OpalConnection::SendUserInputAsTone);
+    break;
 
     // RFC2833
-    case 1:
-      SetSendUserInputMode (OpalConnection::SendUserInputAsInlineRFC2833);
-      break;
-    default:
-      break;
-    }
+  case 1:
+    SetSendUserInputMode (OpalConnection::SendUserInputAsInlineRFC2833);
+    break;
+  default:
+    break;
+  }
 }
 
 
-unsigned GMSIPEndpoint::get_dtmf_mode () const
+unsigned OpalSip::CallProtocolManager::get_dtmf_mode () const
 {
   // SIP Info
   if (GetSendUserInputMode () == OpalConnection::SendUserInputAsTone)
@@ -333,7 +332,7 @@
 }
 
 
-bool GMSIPEndpoint::set_listen_port (unsigned port)
+bool OpalSip::CallProtocolManager::set_listen_port (unsigned port)
 {
   unsigned udp_min, udp_max;
 
@@ -371,55 +370,55 @@
 }
 
 
-const Ekiga::CallProtocolManager::Interface & GMSIPEndpoint::get_listen_interface () const
+const Ekiga::CallProtocolManager::Interface & OpalSip::CallProtocolManager::get_listen_interface () const
 {
   return interface;
 }
 
 
 
-void GMSIPEndpoint::set_forward_uri (const std::string & uri)
+void OpalSip::CallProtocolManager::set_forward_uri (const std::string & uri)
 {
   forward_uri = uri;
 }
 
 
-const std::string & GMSIPEndpoint::get_forward_uri () const
+const std::string & OpalSip::CallProtocolManager::get_forward_uri () const
 {
   return forward_uri;
 }
 
 
-void GMSIPEndpoint::set_outbound_proxy (const std::string & uri)
+void OpalSip::CallProtocolManager::set_outbound_proxy (const std::string & uri)
 {
   outbound_proxy = uri;
   SetProxy (SIPURL (outbound_proxy));
 }
 
 
-const std::string & GMSIPEndpoint::get_outbound_proxy () const
+const std::string & OpalSip::CallProtocolManager::get_outbound_proxy () const
 {
   return outbound_proxy;
 }
 
 
-
-void GMSIPEndpoint::GMSIPEndpoint::set_nat_binding_delay (unsigned delay)
+void OpalSip::CallProtocolManager::set_nat_binding_delay (unsigned delay)
 {
   SetNATBindingTimeout (PTimeInterval (0, delay));
 }
 
 
-unsigned GMSIPEndpoint::GMSIPEndpoint::get_nat_binding_delay ()
+unsigned OpalSip::CallProtocolManager::get_nat_binding_delay ()
 {
   return GetNATBindingTimeout ().GetSeconds ();
 }
 
-void  GMSIPEndpoint::Register (const PString & _aor,
-                               const PString & authUserName,
-                               const PString & password,
-                               unsigned int expires,
-                               bool unregister)
+
+void  OpalSip::CallProtocolManager::Register (const PString & _aor,
+                                              const PString & authUserName,
+                                              const PString & password,
+                                              unsigned int expires,
+                                              bool unregister)
 {
   std::string aor = (const char *) _aor;
   std::stringstream strm;
@@ -452,9 +451,8 @@
 }
 
 
-void
-GMSIPEndpoint::OnRegistered (const PString & _aor,
-                             bool was_registering)
+void OpalSip::CallProtocolManager::OnRegistered (const PString & _aor,
+                                                 bool was_registering)
 {
   std::string aor = (const char *) _aor;
   std::string::size_type found;
@@ -470,7 +468,7 @@
   std::list<std::string>::iterator it = find (aors.begin (), aors.end (), aor);
 
   if (was_registering) {
-   
+
     if (it == aors.end ())
       aors.push_back (strm.str ());
   }
@@ -524,10 +522,9 @@
 }
 
 
-void
-GMSIPEndpoint::OnRegistrationFailed (const PString & _aor,
-                                     SIP_PDU::StatusCodes r,
-                                     bool wasRegistering)
+void OpalSip::CallProtocolManager::OnRegistrationFailed (const PString & _aor,
+                                                         SIP_PDU::StatusCodes r,
+                                                         bool wasRegistering)
 {
   std::stringstream strm;
   std::string info;
@@ -751,12 +748,11 @@
 }
 
 
-bool 
-GMSIPEndpoint::OnIncomingConnection (OpalConnection &connection,
-                                     unsigned options,
-                                     OpalConnection::StringOptions * stroptions)
+bool OpalSip::CallProtocolManager::OnIncomingConnection (OpalConnection &connection,
+                                                         unsigned options,
+                                                         OpalConnection::StringOptions * stroptions)
 {
-  PTRACE (3, "GMSIPEndpoint\tIncoming connection");
+  PTRACE (3, "OpalSip::CallProtocolManager\tIncoming connection");
 
   if (!forward_uri.empty () && endpoint.get_unconditional_forward ())
     connection.ForwardCall (forward_uri);
@@ -770,25 +766,24 @@
   }
   else {
 
-      Opal::Call *call = dynamic_cast<Opal::Call *> (&connection.GetCall ());
-      if (call) {
+    Opal::Call *call = dynamic_cast<Opal::Call *> (&connection.GetCall ());
+    if (call) {
 
-        if (!forward_uri.empty () && endpoint.get_forward_on_no_answer ()) 
-          call->set_no_answer_forward (endpoint.get_reject_delay (), forward_uri);
-        else
-          call->set_reject_delay (endpoint.get_reject_delay ());
-      }
+      if (!forward_uri.empty () && endpoint.get_forward_on_no_answer ()) 
+        call->set_no_answer_forward (endpoint.get_reject_delay (), forward_uri);
+      else
+        call->set_reject_delay (endpoint.get_reject_delay ());
+    }
 
     return SIPEndPoint::OnIncomingConnection (connection, options, stroptions);
   }
-  
+
   return false;
 }
 
 
-void 
-GMSIPEndpoint::OnReceivedMESSAGE (G_GNUC_UNUSED OpalTransport & transport,
-                                  SIP_PDU & pdu)
+void OpalSip::CallProtocolManager::OnReceivedMESSAGE (G_GNUC_UNUSED OpalTransport & transport,
+                                                      SIP_PDU & pdu)
 {
   PString *last = NULL;
   PString *val = NULL;
@@ -819,9 +814,8 @@
 }
 
 
-void 
-GMSIPEndpoint::OnMessageFailed (const SIPURL & messageUrl,
-                                SIP_PDU::StatusCodes /*reason*/)
+void OpalSip::CallProtocolManager::OnMessageFailed (const SIPURL & messageUrl,
+                                                    SIP_PDU::StatusCodes /*reason*/)
 {
   SIPURL to = messageUrl;
   to.AdjustForRequestURI ();
@@ -831,8 +825,7 @@
 }
 
 
-SIPURL
-GMSIPEndpoint::GetRegisteredPartyName (const SIPURL & host)
+SIPURL OpalSip::CallProtocolManager::GetRegisteredPartyName (const SIPURL & host)
 {
   GmAccount *account = NULL;
 
@@ -843,7 +836,7 @@
   SIPURL registration_address;
 
   /* If we are registered to an account corresponding to host, use it.
-   */
+  */
   PSafePtr<SIPHandler> info = activeSIPHandlers.FindSIPHandlerByDomain(host.GetHostName (), SIP_PDU::Method_REGISTER, PSafeReadOnly);
   if (info != NULL) {
 
@@ -887,9 +880,9 @@
 
 
 void 
-GMSIPEndpoint::OnPresenceInfoReceived (const PString & user,
-                                       const PString & basic,
-                                       const PString & note)
+OpalSip::CallProtocolManager::OnPresenceInfoReceived (const PString & user,
+                                                      const PString & basic,
+                                                      const PString & note)
 {
   PINDEX j;
   PCaselessString b = basic;
@@ -915,10 +908,10 @@
   else if (s.Find ("dnd") != P_MAX_INDEX
            || s.Find ("Do Not Disturb") != P_MAX_INDEX) 
     presence = "presence-dnd";
-  
+
   else if (s.Find ("Free For Chat") != P_MAX_INDEX) 
     presence = "presence-freeforchat";
-  
+
   if ((j = s.Find (" - ")) != P_MAX_INDEX)
     status = (const char *) note.Mid (j + 3);
 
@@ -931,14 +924,15 @@
 }
 
 
-void GMSIPEndpoint::on_dial (std::string uri)
+void OpalSip::CallProtocolManager::on_dial (std::string uri)
 {
   endpoint.dial (uri);
 }
 
 
-void GMSIPEndpoint::on_message (const std::string & name,
-                                const std::string & uri)
+void OpalSip::CallProtocolManager::on_message (const std::string & name,
+                                               const std::string & uri)
 {
   runtime.run_in_main (sigc::bind (new_chat.make_slot (), name, uri));
 }
+

Modified: trunk/src/endpoints/sip.h
==============================================================================
--- trunk/src/endpoints/sip.h	(original)
+++ trunk/src/endpoints/sip.h	Mon Jun  2 20:35:45 2008
@@ -55,129 +55,131 @@
 
 class Ekiga::PersonalDetails;
 
-class GMSIPEndpoint 
-:   public SIPEndPoint, 
-    public Ekiga::ChatManager,
-    public Ekiga::CallProtocolManager,
-    public Ekiga::PresenceFetcher,
-    public Ekiga::PresencePublisher,
-    public Ekiga::PresentityDecorator,
-    public Ekiga::ContactDecorator
-{
-  PCLASSINFO(GMSIPEndpoint, SIPEndPoint);
+namespace OpalSip {
+
+  class CallProtocolManager : public SIPEndPoint, 
+                              public Ekiga::ChatManager,
+                              public Ekiga::CallProtocolManager,
+                              public Ekiga::PresenceFetcher,
+                              public Ekiga::PresencePublisher,
+                              public Ekiga::PresentityDecorator,
+                              public Ekiga::ContactDecorator
+  {
+    PCLASSINFO(CallProtocolManager, SIPEndPoint);
 
 public:
 
-  GMSIPEndpoint (GMManager &ep, Ekiga::ServiceCore & core, unsigned listen_port);
+    CallProtocolManager (GMManager &ep, Ekiga::ServiceCore & core, unsigned listen_port);
 
 
-  /* ContactDecorator and PresentityDecorator */
-  bool populate_menu (Ekiga::Contact &contact,
-                      Ekiga::MenuBuilder &builder);
+    /* ContactDecorator and PresentityDecorator */
+    bool populate_menu (Ekiga::Contact &contact,
+                        Ekiga::MenuBuilder &builder);
 
-  bool populate_menu (const std::string uri,
-                      Ekiga::MenuBuilder & builder);
+    bool populate_menu (const std::string uri,
+                        Ekiga::MenuBuilder & builder);
 
-  bool menu_builder_add_actions (const std::string & fullname,
-                                 std::map<std::string, std::string> & uris,
-                                 Ekiga::MenuBuilder & builder);
+    bool menu_builder_add_actions (const std::string & fullname,
+                                   std::map<std::string, std::string> & uris,
+                                   Ekiga::MenuBuilder & builder);
 
 
-  /* PresenceFetcher */
-  void fetch (const std::string uri);
-  void unfetch (const std::string uri);
+    /* PresenceFetcher */
+    void fetch (const std::string uri);
+    void unfetch (const std::string uri);
 
 
-  /* PresencePublisher */
-  void publish (const Ekiga::PersonalDetails & details);
+    /* PresencePublisher */
+    void publish (const Ekiga::PersonalDetails & details);
 
 
-  /* ChatManager */
-  bool send_message (const std::string & uri, 
-                     const std::string & message);
+    /* ChatManager */
+    bool send_message (const std::string & uri, 
+                       const std::string & message);
 
 
-  /* CallProtocolManager */
-  bool dial (const std::string & uri); 
+    /* CallProtocolManager */
+    bool dial (const std::string & uri); 
 
-  const std::string & get_protocol_name () const;
+    const std::string & get_protocol_name () const;
 
-  void set_dtmf_mode (unsigned mode);
-  unsigned get_dtmf_mode () const;
+    void set_dtmf_mode (unsigned mode);
+    unsigned get_dtmf_mode () const;
 
-  bool set_listen_port (unsigned port);
-  const Ekiga::CallProtocolManager::Interface & get_listen_interface () const;
+    bool set_listen_port (unsigned port);
+    const Ekiga::CallProtocolManager::Interface & get_listen_interface () const;
 
 
-  /* SIP CallProtocolManager */
-  void set_nat_binding_delay (unsigned delay);
-  unsigned get_nat_binding_delay ();
+    /* SIP CallProtocolManager */
+    void set_nat_binding_delay (unsigned delay);
+    unsigned get_nat_binding_delay ();
 
-  void set_outbound_proxy (const std::string & uri);
-  const std::string & get_outbound_proxy () const;
+    void set_outbound_proxy (const std::string & uri);
+    const std::string & get_outbound_proxy () const;
 
-  void set_forward_uri (const std::string & uri);
-  const std::string & get_forward_uri () const;
+    void set_forward_uri (const std::string & uri);
+    const std::string & get_forward_uri () const;
 
 
-  /* OPAL Methods */
-  void Register (const PString & aor,
-                 const PString & authUserName,
-                 const PString & password,
-                 unsigned int expires,
-                 bool unregister);
+    /* OPAL Methods */
+    void Register (const PString & aor,
+                   const PString & authUserName,
+                   const PString & password,
+                   unsigned int expires,
+                   bool unregister);
 
-  void OnRegistered (const PString & aor,
-                     bool wasRegistering);
+    void OnRegistered (const PString & aor,
+                       bool wasRegistering);
 
-  void OnRegistrationFailed (const PString & aor,
-                             SIP_PDU::StatusCodes reason,
-                             bool wasRegistering);
+    void OnRegistrationFailed (const PString & aor,
+                               SIP_PDU::StatusCodes reason,
+                               bool wasRegistering);
 
-  bool OnIncomingConnection (OpalConnection &connection,
-                             unsigned options,
-                             OpalConnection::StringOptions * stroptions);
+    bool OnIncomingConnection (OpalConnection &connection,
+                               unsigned options,
+                               OpalConnection::StringOptions * stroptions);
 
-  virtual void OnPresenceInfoReceived (const PString & user,
-                                       const PString & basic,
-                                       const PString & note);
+    virtual void OnPresenceInfoReceived (const PString & user,
+                                         const PString & basic,
+                                         const PString & note);
 
-  virtual void OnReceivedMESSAGE (OpalTransport & transport,
-                                  SIP_PDU & pdu);
+    virtual void OnReceivedMESSAGE (OpalTransport & transport,
+                                    SIP_PDU & pdu);
 
-  void OnMessageFailed (const SIPURL & messageUrl,
-                        SIP_PDU::StatusCodes reason);
+    void OnMessageFailed (const SIPURL & messageUrl,
+                          SIP_PDU::StatusCodes reason);
 
-  SIPURL GetRegisteredPartyName (const SIPURL & host);
+    SIPURL GetRegisteredPartyName (const SIPURL & host);
 
 
-  /* Callbacks */
+    /* Callbacks */
 private:
-  void on_dial (std::string uri);
+    void on_dial (std::string uri);
 
-  void on_message (const std::string & name,
-                   const std::string & uri);
+    void on_message (const std::string & name,
+                     const std::string & uri);
 
 
-  PMutex msgDataMutex;
-  msgDict msgData;
+    PMutex msgDataMutex;
+    msgDict msgData;
 
-  GMManager & endpoint;
+    GMManager & endpoint;
 
-  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
-  Ekiga::ServiceCore & core;
-  Ekiga::PresenceCore & presence_core;
-  Ekiga::Runtime & runtime;
+    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
+    Ekiga::ServiceCore & core;
+    Ekiga::PresenceCore & presence_core;
+    Ekiga::Runtime & runtime;
 
-  Ekiga::CallProtocolManager::Interface interface;
+    Ekiga::CallProtocolManager::Interface interface;
 
-  std::string protocol_name;
-  std::string uri_prefix;
-  std::string forward_uri;
-  std::string outbound_proxy;
+    std::string protocol_name;
+    std::string uri_prefix;
+    std::string forward_uri;
+    std::string outbound_proxy;
 
-  unsigned listen_port;
+    unsigned listen_port;
+  };
 };
 #endif



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