[ekiga] Presence: Only fetch presence for current account.



commit 1e2748a8657b462e8a1d152c2fb451df4e360a11
Author: Damien Sandras <dsandras beip be>
Date:   Sat Nov 19 12:44:48 2011 +0100

    Presence: Only fetch presence for current account.
    
    We were fetching presence of the same list of uris for each account
    instance. Only fetch if account is enabled.
    
    This asks the question: shouldn't we fetch presence only if the uri
    correspond to the account at the presence core level instead of passing
    the list of all uris to all account instances?

 lib/engine/components/opal/opal-account.cpp |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/lib/engine/components/opal/opal-account.cpp b/lib/engine/components/opal/opal-account.cpp
index 485885f..c28138d 100644
--- a/lib/engine/components/opal/opal-account.cpp
+++ b/lib/engine/components/opal/opal-account.cpp
@@ -529,6 +529,17 @@ Opal::Account::publish (const Ekiga::PersonalDetails& details)
 void
 Opal::Account::fetch (const std::string uri)
 {
+  if (!is_enabled ())
+    return;
+
+  size_t pos = uri.find ("@");
+  if (pos == string::npos)
+    return;
+
+  std::string uri_host = uri.substr (++pos);
+  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]