[ekiga] Made it possible to remove a roster contact



commit f724886b2fb6dc9f26273006378221abff14f356
Author: Julien Puydt <jpuydt noether localdomain>
Date:   Sat Nov 29 23:29:00 2008 +0100

    Made it possible to remove a roster contact

 .../components/loudmouth/loudmouth-presentity.cpp  |   19 +++++++++++++++++++
 .../components/loudmouth/loudmouth-presentity.h    |    2 ++
 2 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/lib/engine/components/loudmouth/loudmouth-presentity.cpp b/lib/engine/components/loudmouth/loudmouth-presentity.cpp
index 9483aa7..d7dcf89 100644
--- a/lib/engine/components/loudmouth/loudmouth-presentity.cpp
+++ b/lib/engine/components/loudmouth/loudmouth-presentity.cpp
@@ -115,6 +115,8 @@ LM::Presentity::populate_menu (Ekiga::MenuBuilder& builder)
 {
   builder.add_action ("edit", _("_Edit"),
 		      sigc::mem_fun (this, &LM::Presentity::edit_presentity));
+  builder.add_action ("remove", _("_Remove"),
+		      sigc::mem_fun (this, &LM::Presentity::remove_presentity));
   return true;
 }
 
@@ -198,3 +200,20 @@ LM::Presentity::edit_presentity_form_submitted (bool submitted,
 #endif
   }
 }
+
+void
+LM::Presentity::remove_presentity ()
+{
+  LmMessage* message = lm_message_new_with_sub_type (NULL, LM_MESSAGE_TYPE_IQ, LM_MESSAGE_SUB_TYPE_SET);
+  LmMessageNode* query = lm_message_node_add_child (lm_message_get_node (message), "query", NULL);
+  lm_message_node_set_attribute (query, "xmlns", "jabber:iq:roster");
+  LmMessageNode* node = lm_message_node_add_child (query, "item", NULL);
+
+  lm_message_node_set_attributes (node,
+				  "jid", get_jid ().c_str (),
+				  "subscription", "remove",
+				  NULL);
+
+  lm_connection_send (connection, message, NULL);
+  lm_message_unref (message);
+}
diff --git a/lib/engine/components/loudmouth/loudmouth-presentity.h b/lib/engine/components/loudmouth/loudmouth-presentity.h
index 59df1eb..923ea5a 100644
--- a/lib/engine/components/loudmouth/loudmouth-presentity.h
+++ b/lib/engine/components/loudmouth/loudmouth-presentity.h
@@ -79,6 +79,8 @@ namespace LM
 
     void edit_presentity_form_submitted (bool submitted,
 					 Ekiga::Form& result);
+
+    void remove_presentity ();
   };
 };
 



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