[ekiga] Opal: Moved MessageSummary subscription to Opal::Account.



commit b060d2bcf117cf4f3332b30e297b15557dbdab23
Author: Damien Sandras <dsandras beip be>
Date:   Sun Jan 20 17:58:59 2013 +0100

    Opal: Moved MessageSummary subscription to Opal::Account.
    
    This allows subscribing/unsubscribing when enabling and disabling SIP
    accounts. It should fix the bug where OPTIONS requests keep being sent
    after the account has been disabled.

 lib/engine/components/opal/opal-account.cpp |   10 ++++++++--
 lib/engine/components/opal/sip-endpoint.cpp |    4 ----
 2 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/lib/engine/components/opal/opal-account.cpp b/lib/engine/components/opal/opal-account.cpp
index 9747c35..eed9cd6 100644
--- a/lib/engine/components/opal/opal-account.cpp
+++ b/lib/engine/components/opal/opal-account.cpp
@@ -348,8 +348,10 @@ void Opal::Account::disable ()
     h323_endpoint->unsubscribe (*this, presentity);
   else
 #endif
-    sip_endpoint->unsubscribe (*this, presentity);
-
+    {
+      sip_endpoint->unsubscribe (*this, presentity);
+      sip_endpoint->Unsubscribe (SIPSubscribe::MessageSummary, get_aor ());
+    }
   // Translators: this is a state, not an action, i.e. it should be read as
   // "(you are) unregistered", and not as "(you have been) unregistered"
   status = _("Unregistered");
@@ -646,9 +648,13 @@ Opal::Account::handle_registration_event (RegistrationState state_,
           presentity->SubscribeToPresence (PString (*iter));
         }
         presentity->SetLocalPresence (personal_state, presence_status);
+        if (type != Account::H323) {
+          sip_endpoint->Subscribe (SIPSubscribe::MessageSummary, 3600, get_aor ());
+        }
       }
       if (presence_core && personal_details)
 	presence_core->publish (personal_details);
+
       state = state_;
       failed_registration_already_notified = false;
       updated ();
diff --git a/lib/engine/components/opal/sip-endpoint.cpp b/lib/engine/components/opal/sip-endpoint.cpp
index b0ae810..ff50314 100644
--- a/lib/engine/components/opal/sip-endpoint.cpp
+++ b/lib/engine/components/opal/sip-endpoint.cpp
@@ -995,10 +995,6 @@ Opal::Sip::EndPoint::registration_event_in_main (const std::string aor,
 						 Opal::Account::RegistrationState state,
 						 const std::string msg)
 {
-  /* Subscribe for MWI */
-  if (state == Opal::Account::Registered &&!IsSubscribed (SIPSubscribe::MessageSummary, aor))
-    Subscribe (SIPSubscribe::MessageSummary, 3600, aor);
-
   if (boost::shared_ptr<Opal::Bank> bk = bank.lock ()) {
 
     AccountPtr account = bk->find_account (aor);



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