[ekiga] Made the roster have the same name as the jabber account



commit 095d11c85d3e525e9549da335fac84d3637c75ae
Author: Julien Puydt <jpuydt gnome org>
Date:   Thu Jun 11 15:48:04 2009 +0200

    Made the roster have the same name as the jabber account
    
    This should be better for users

 .../components/loudmouth/loudmouth-account.cpp     |    1 +
 lib/engine/components/loudmouth/loudmouth-heap.cpp |   20 ++++++++++++++------
 lib/engine/components/loudmouth/loudmouth-heap.h   |    6 ++++++
 3 files changed, 21 insertions(+), 6 deletions(-)
---
diff --git a/lib/engine/components/loudmouth/loudmouth-account.cpp b/lib/engine/components/loudmouth/loudmouth-account.cpp
index 4554a38..1210f05 100644
--- a/lib/engine/components/loudmouth/loudmouth-account.cpp
+++ b/lib/engine/components/loudmouth/loudmouth-account.cpp
@@ -248,6 +248,7 @@ LM::Account::on_authenticate (bool result)
   if (result) {
 
     heap = gmref_ptr<Heap> (new Heap (details, dialect, connection));
+    heap->set_name (name);
     cluster->add_heap (heap);
     status = _("connected");
     updated.emit ();
diff --git a/lib/engine/components/loudmouth/loudmouth-heap.cpp b/lib/engine/components/loudmouth/loudmouth-heap.cpp
index aa62cd1..82b8616 100644
--- a/lib/engine/components/loudmouth/loudmouth-heap.cpp
+++ b/lib/engine/components/loudmouth/loudmouth-heap.cpp
@@ -123,7 +123,14 @@ LM::Heap::~Heap ()
 const std::string
 LM::Heap::get_name () const
 {
-  return lm_connection_get_jid (connection);
+  return name;
+}
+
+void
+LM::Heap::set_name (const std::string name_)
+{
+  name = name_;
+  updated.emit ();
 }
 
 bool
@@ -191,14 +198,14 @@ LM::Heap::presence_handler (LmMessage* message)
     Ekiga::FormRequestSimple request (sigc::mem_fun (this, &LM::Heap::subscribe_from_form_submitted));
     LmMessageNode* status = lm_message_node_find_child (lm_message_get_node (message), "status");
     gchar* instructions = NULL;
-    std::string name;
+    std::string item_name;
 
     if (item) {
 
-      name = item->get_name ();
+      item_name = item->get_name ();
     } else {
 
-      name = base_jid;
+      item_name = base_jid;
     }
 
     request.title (_("Authorization to see your presence"));
@@ -206,10 +213,11 @@ LM::Heap::presence_handler (LmMessage* message)
     if (status != NULL && lm_message_node_get_value (status) != NULL) {
 
       instructions = g_strdup_printf (_("%s asks the permission to see your presence, saying: \"%s\"."),
-				      name.c_str (), lm_message_node_get_value (status));
+				      item_name.c_str (), lm_message_node_get_value (status));
     } else {
 
-      instructions = g_strdup_printf (_("%s asks the permission to see your presence."), name.c_str ());
+      instructions = g_strdup_printf (_("%s asks the permission to see your presence."),
+				      item_name.c_str ());
     }
     request.instructions (instructions);
     g_free (instructions);
diff --git a/lib/engine/components/loudmouth/loudmouth-heap.h b/lib/engine/components/loudmouth/loudmouth-heap.h
index dec8dbf..016db45 100644
--- a/lib/engine/components/loudmouth/loudmouth-heap.h
+++ b/lib/engine/components/loudmouth/loudmouth-heap.h
@@ -63,6 +63,10 @@ namespace LM
 
     void disconnected ();
 
+    /* public to be accessed by the account */
+
+    void set_name (const std::string name_);
+
     /* public to be accessed by C callbacks */
 
     LmHandlerResult iq_handler (LmMessage* message);
@@ -77,6 +81,8 @@ namespace LM
 
     DialectPtr dialect;
 
+    std::string name;
+
     LmConnection* connection;
 
     LmMessageHandler* iq_lm_handler;



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