changeset 25589:3f719eaa7fd1

* IPC work * removed g_free which may've resulted in a bug
author Tobias Markmann <tfar@soc.pidgin.im>
date Tue, 08 Jul 2008 15:05:45 +0000
parents 61f37abc8a70
children 7f6558c7a0a3
files libpurple/protocols/jabber/caps.c libpurple/protocols/jabber/jabber.c
diffstat 2 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/caps.c	Mon Jul 07 18:28:05 2008 +0000
+++ b/libpurple/protocols/jabber/caps.c	Tue Jul 08 15:05:45 2008 +0000
@@ -227,11 +227,12 @@
 
 static void jabber_caps_store(void) {
 	char *str;
+	int length = 0;
 	xmlnode *root = xmlnode_new("capabilities");
 	g_hash_table_foreach(capstable, jabber_caps_store_client, root);
-	str = xmlnode_to_formatted_str(root, NULL);
+	str = xmlnode_to_formatted_str(root, &length);
 	xmlnode_free(root);
-	purple_util_write_data_to_file(JABBER_CAPS_FILENAME, str, -1);
+	purple_util_write_data_to_file(JABBER_CAPS_FILENAME, str, length);
 	g_free(str);
 }
 
@@ -535,7 +536,6 @@
 	client = g_hash_table_lookup(capstable, key);
 
 	g_hash_table_replace(jabber_contact_info, g_strdup(who), key);
-	g_free(key);
 	
 	if(!client) {
 		JabberIq *iq = jabber_iq_new_query(js,JABBER_IQ_GET,"http://jabber.org/protocol/disco#info");
--- a/libpurple/protocols/jabber/jabber.c	Mon Jul 07 18:28:05 2008 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Tue Jul 08 15:05:45 2008 +0000
@@ -2477,8 +2477,9 @@
 jabber_ipc_add_feature(gchar *feature) 
 {
 	if (feature == 0) return;
+	jabber_add_feature(feature, 0);
 	
-	jabber_add_feature(feature, 0);
+	// send presence with new caps info for all connected accounts
 }
 
 void
@@ -2516,4 +2517,8 @@
 							 purple_value_new(PURPLE_TYPE_BOOLEAN), 2,
 							 purple_value_new(PURPLE_TYPE_STRING),
 							 purple_value_new(PURPLE_TYPE_STRING));
-}
\ No newline at end of file
+	purple_plugin_ipc_register(plugin, "add_feature", PURPLE_CALLBACK(jabber_ipc_add_feature),
+							 purple_marshal_VOID__POINTER,
+							 NULL, 1,
+							 purple_value_new(PURPLE_TYPE_STRING));
+}