[ekiga] Opal: Create the OpalPresentity in the SIPEndPoint.



commit a6c65a867a73ec1c6f406057dcfc5489bde626fa
Author: Damien Sandras <dsandras seconix com>
Date:   Sun Jan 25 13:13:47 2015 +0100

    Opal: Create the OpalPresentity in the SIPEndPoint.
    
    Creating it in the Opal:Account means we need to keep a reference to the
    OpalCallManager. The SIPEndPoint is handling things and relaying its
    work to the Account, thus creating the OpalPresentity there was useless.

 lib/engine/components/opal/opal-account.cpp |   11 +++++------
 lib/engine/components/opal/opal-account.h   |    3 ++-
 lib/engine/components/opal/sip-endpoint.cpp |    3 ++-
 3 files changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/lib/engine/components/opal/opal-account.cpp b/lib/engine/components/opal/opal-account.cpp
index 492e56e..a543d9a 100644
--- a/lib/engine/components/opal/opal-account.cpp
+++ b/lib/engine/components/opal/opal-account.cpp
@@ -909,11 +909,15 @@ Opal::Account::is_supported_uri (const std::string & uri)
 
 void
 Opal::Account::handle_registration_event (Ekiga::Account::RegistrationState state_,
-                                         const std::string info)
+                                         const std::string info,
+                                          PSafePtr<OpalPresentity> _opal_presentity)
 {
   if (state == state_)
     return; // The state did not change...
 
+  if (_opal_presentity)
+    opal_presentity = _opal_presentity;
+
   switch (state_) {
 
   case Registered:
@@ -926,11 +930,6 @@ Opal::Account::handle_registration_event (Ekiga::Account::RegistrationState stat
       state = state_;
       failed_registration_already_notified = false;
 
-      boost::shared_ptr<Opal::CallManager> cmanager = call_manager.lock ();
-      if (cmanager) {
-        PURL url = PString (get_transaction_aor (get_aor ()));
-        opal_presentity = cmanager->AddPresentity (url);
-      }
       if (opal_presentity) {
 
         opal_presentity->SetPresenceChangeNotifier (PCREATE_PresenceChangeNotifier (OnPresenceChange));
diff --git a/lib/engine/components/opal/opal-account.h b/lib/engine/components/opal/opal-account.h
index 6f9628d..ad03fe5 100644
--- a/lib/engine/components/opal/opal-account.h
+++ b/lib/engine/components/opal/opal-account.h
@@ -175,7 +175,8 @@ public:
      * want its Register method to take a const account...
      */
     void handle_registration_event (RegistrationState state_,
-                                   const std::string info);
+                                   const std::string info,
+                                    PSafePtr<OpalPresentity> _opal_presentity = NULL);
 
     /* This method is public to be called by an opal endpoint, which will push
      * this Opal::Account's message waiting information
diff --git a/lib/engine/components/opal/sip-endpoint.cpp b/lib/engine/components/opal/sip-endpoint.cpp
index 3bd32be..bc73bda 100644
--- a/lib/engine/components/opal/sip-endpoint.cpp
+++ b/lib/engine/components/opal/sip-endpoint.cpp
@@ -444,7 +444,8 @@ Opal::Sip::EndPoint::OnRegistrationStatus (const RegistrationStatus & status)
   /* Successful registration or unregistration */
   if (status.m_reason == SIP_PDU::Successful_OK) {
     account->handle_registration_event (status.m_wasRegistering?Account::Registered:Account::Unregistered,
-                                        std::string ());
+                                        std::string (),
+                                        manager.AddPresentity (PURL (status.m_addressofRecord)));
   }
   /* Registration or unregistration failure */
   else {


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