[ekiga] Made the opal account code try to push self-presence information



commit de3563f36f96a7d09c0506b57619fb6f68b00a76
Author: Snark <jpuydt gnome org>
Date:   Thu Dec 23 21:27:06 2010 +0100

    Made the opal account code try to push self-presence information
    
    In fact, it will fail since the presentity isn't initialized properly yet ;-)

 lib/engine/components/opal/opal-account.cpp |   17 ++++++++++++++++-
 lib/engine/components/opal/opal-account.h   |    6 ++++++
 2 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/lib/engine/components/opal/opal-account.cpp b/lib/engine/components/opal/opal-account.cpp
index 3503223..c5ba5f8 100644
--- a/lib/engine/components/opal/opal-account.cpp
+++ b/lib/engine/components/opal/opal-account.cpp
@@ -472,6 +472,21 @@ Opal::Account::on_consult (const std::string url)
   gm_open_uri (url.c_str ());
 }
 
+void
+Opal::Account::publish (const Ekiga::PersonalDetails& details)
+{
+  if (presentity && presentity->IsOpen ()) {
+
+    std::string presence = details.get_presence ();
+    OpalPresenceInfo::State personal_state = OpalPresenceInfo::Unavailable;
+
+    // FIXME: complete!
+    if (presence == "online")
+      personal_state = OpalPresenceInfo::Available;
+
+    presentity->SetLocalPresence (personal_state, details.get_status ());
+  }
+}
 
 void
 Opal::Account::handle_registration_event (RegistrationState state_,
@@ -490,7 +505,7 @@ Opal::Account::handle_registration_event (RegistrationState state_,
 	presence_core->publish (personal_details);
       state = state_;
       updated ();
-    } 
+    }
     break;
 
   case Unregistered:
diff --git a/lib/engine/components/opal/opal-account.h b/lib/engine/components/opal/opal-account.h
index 30f6252..b552bc0 100644
--- a/lib/engine/components/opal/opal-account.h
+++ b/lib/engine/components/opal/opal-account.h
@@ -38,8 +38,11 @@
 #ifndef __OPAL_ACCOUNT_H__
 #define __OPAL_ACCOUNT_H__
 
+#include <opal/pres_ent.h>
+
 #include "services.h"
 #include "account-core.h"
+#include "personal-details.h"
 #include "account.h"
 #include "form.h"
 #include "bank-impl.h"
@@ -142,6 +145,8 @@ public:
 
     boost::signal0<void> trigger_saving;
 
+    void publish (const Ekiga::PersonalDetails& details);
+
     /* This method is public to be called by an opal endpoint, which will push
      * this Opal::Account's new registration state
      * Notice : it's very wrong to make that a const method, but Opal seems to
@@ -176,6 +181,7 @@ private:
     std::string auth_username;
     std::string password;
     Type type;
+    boost::shared_ptr<OpalPresentity> presentity;
 
     Ekiga::ServiceCore & core;
   };



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