[ekiga] Accounts: Fixed account toggling/untoggling and presence.



commit 64df120534fe8659a2cac19d590864efffe97ad3
Author: Damien Sandras <dsandras beip be>
Date:   Sun Dec 4 13:31:50 2011 +0100

    Accounts: Fixed account toggling/untoggling and presence.
    
    When you enable an account, it now subscribe to presentities again.
    We just update watched_uris even if we do not fetch presence info
    because the corresponding account is not enabled.
    
    When you disable an account, the presentity information changes
    to unknown so that wrong information is not displayed.
    
    A bug remains in opal though when subscribe/unsubscribe/subscribe.

 lib/engine/components/opal/opal-account.cpp |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/lib/engine/components/opal/opal-account.cpp b/lib/engine/components/opal/opal-account.cpp
index 7fcdd19..385bc85 100644
--- a/lib/engine/components/opal/opal-account.cpp
+++ b/lib/engine/components/opal/opal-account.cpp
@@ -308,8 +308,9 @@ void Opal::Account::enable ()
     // FIXME : the following actions should probably be done by opal itself,
     // remembering what ekiga asked...
     for (std::set<std::string>::iterator iter = watched_uris.begin ();
-         iter != watched_uris.end (); ++iter)
+         iter != watched_uris.end (); ++iter) {
       presentity->SubscribeToPresence (PString (*iter));
+    }
     presentity->SetLocalPresence (personal_state, presence_status);
   }
 
@@ -324,8 +325,17 @@ void Opal::Account::disable ()
 
   endpoint->unsubscribe (*this);
 
-  if (presentity)
+  if (presentity) {
+
     presentity->Close ();
+    // FIXME : the following actions should probably be done by opal itself,
+    // remembering what ekiga asked...
+    for (std::set<std::string>::iterator iter = watched_uris.begin ();
+         iter != watched_uris.end (); ++iter) {
+      presentity->UnsubscribeFromPresence (PString (*iter));
+      Ekiga::Runtime::run_in_main (boost::bind (&Opal::Account::presence_status_in_main, this, (*iter), "unknown", ""));
+    }
+  }
 
   updated ();
   trigger_saving ();
@@ -529,6 +539,9 @@ Opal::Account::publish (const Ekiga::PersonalDetails& details)
 void
 Opal::Account::fetch (const std::string uri)
 {
+  watched_uris.insert (uri); // URI will be watched, but we only subscribe for
+                             // presence information if the account is enabled
+
   if (!is_enabled ())
     return;
 
@@ -540,7 +553,6 @@ Opal::Account::fetch (const std::string uri)
   if (uri_host != get_host ())
     return;
 
-  watched_uris.insert (uri);
   if (presentity)
     presentity->SubscribeToPresence (PString (uri));
 }



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