[ekiga] Handled contact removal



commit 9ff67334c38fdac2245eb4bc61e3d9cac1400e84
Author: Julien Puydt <jpuydt noether localdomain>
Date:   Sat Nov 29 23:03:17 2008 +0100

    Handled contact removal

 lib/engine/components/loudmouth/loudmouth-heap.cpp |    9 +++++-
 .../components/loudmouth/loudmouth-presentity.cpp  |   30 ++++++++++----------
 .../components/loudmouth/loudmouth-presentity.h    |   10 ++++--
 3 files changed, 30 insertions(+), 19 deletions(-)
---
diff --git a/lib/engine/components/loudmouth/loudmouth-heap.cpp b/lib/engine/components/loudmouth/loudmouth-heap.cpp
index 96b99bb..d4b58c3 100644
--- a/lib/engine/components/loudmouth/loudmouth-heap.cpp
+++ b/lib/engine/components/loudmouth/loudmouth-heap.cpp
@@ -138,8 +138,15 @@ LM::Heap::parse_roster (LmMessageNode* query)
 
       if ((*iter)->get_jid () == jid) {
 
-	(*iter)->update (node);
 	found = true;
+	const gchar* subscription = lm_message_node_get_attribute (node, "subscription");
+	if (subscription != NULL && strcmp (subscription, "remove") == 0) {
+
+	  (*iter)->removed.emit ();
+	} else {
+
+	  (*iter)->update (node);
+	}
       }
     }
     if ( !found) {
diff --git a/lib/engine/components/loudmouth/loudmouth-presentity.cpp b/lib/engine/components/loudmouth/loudmouth-presentity.cpp
index 709f47d..8ab0765 100644
--- a/lib/engine/components/loudmouth/loudmouth-presentity.cpp
+++ b/lib/engine/components/loudmouth/loudmouth-presentity.cpp
@@ -57,21 +57,6 @@ LM::Presentity::~Presentity ()
   connection = 0;
 }
 
-void
-LM::Presentity::update (LmMessageNode* item_)
-{
-  lm_message_node_unref (item);
-  item = item_;
-  lm_message_node_ref (item);
-  updated.emit ();
-}
-
-const std::string
-LM::Presentity::get_jid () const
-{
-  return lm_message_node_get_attribute (item, "jid");
-}
-
 const std::string
 LM::Presentity::get_name () const
 {
@@ -127,3 +112,18 @@ LM::Presentity::populate_menu (Ekiga::MenuBuilder& /*builder*/)
 {
   return false; // FIXME
 }
+
+const std::string
+LM::Presentity::get_jid () const
+{
+  return lm_message_node_get_attribute (item, "jid");
+}
+
+void
+LM::Presentity::update (LmMessageNode* item_)
+{
+  lm_message_node_unref (item);
+  item = item_;
+  lm_message_node_ref (item);
+  updated.emit ();
+}
diff --git a/lib/engine/components/loudmouth/loudmouth-presentity.h b/lib/engine/components/loudmouth/loudmouth-presentity.h
index 7e9e46b..2724ced 100644
--- a/lib/engine/components/loudmouth/loudmouth-presentity.h
+++ b/lib/engine/components/loudmouth/loudmouth-presentity.h
@@ -51,9 +51,7 @@ namespace LM
 
     ~Presentity ();
 
-    void update (LmMessageNode* item_);
-
-    const std::string get_jid () const;
+    /* usual presentity stuff */
 
     const std::string get_name () const;
 
@@ -67,6 +65,12 @@ namespace LM
 
     bool populate_menu (Ekiga::MenuBuilder& builder);
 
+    /* special presentity stuff */
+
+    const std::string get_jid () const;
+
+    void update (LmMessageNode* item_);
+
   private:
     LmConnection* connection;
     LmMessageNode* item;



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