changeset 30487:a2d5bafdbea9

perl: Fix chat-related functions. Purple::BuddyList::Chat::new needs to copy the strings, since the GHashTable is long-listing. The serv_join_chat wrapper needs to free the hash table, since that one isn't owned by the prpl.
author Paul Aurich <paul@darkrain42.org>
date Sun, 05 Sep 2010 01:30:56 +0000
parents 54461ce5f7e0
children cd7b7fa1a420 0149f914962e
files ChangeLog.API libpurple/plugins/perl/common/BuddyList.xs libpurple/plugins/perl/common/Server.xs
diffstat 3 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog.API	Sat Sep 04 17:47:46 2010 +0000
+++ b/ChangeLog.API	Sun Sep 05 01:30:56 2010 +0000
@@ -1,6 +1,11 @@
 Pidgin and Finch: The Pimpin' Penguin IM Clients That're Good for the Soul
 
 version 2.7.4 (MM/DD/YYYY):
+	Perl:
+		Changed:
+		* Purple::BuddyList::Chat::new now works properly.  Thanks
+		  to Rafael in devel@conference.pidgin.im for reporting and
+		  testing.
 
 version 2.7.3 (08/10/2010):
 	libpurple:
--- a/libpurple/plugins/perl/common/BuddyList.xs	Sat Sep 04 17:47:46 2010 +0000
+++ b/libpurple/plugins/perl/common/BuddyList.xs	Sun Sep 05 01:30:56 2010 +0000
@@ -345,14 +345,14 @@
 	char *t_key, *t_value;
 CODE:
 	t_HV =  (HV *)SvRV(components);
-	t_GHash = g_hash_table_new(g_str_hash, g_str_equal);
+	t_GHash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
 
 	for (t_HE = hv_iternext(t_HV); t_HE != NULL; t_HE = hv_iternext(t_HV) ) {
 		t_key = hv_iterkey(t_HE, &len);
 		t_SV = *hv_fetch(t_HV, t_key, len, 0);
 		t_value = SvPVutf8_nolen(t_SV);
 
-		g_hash_table_insert(t_GHash, t_key, t_value);
+		g_hash_table_insert(t_GHash, g_strdup(t_key), g_strdup(t_value));
 	}
 
 	RETVAL = purple_chat_new(account, alias, t_GHash);
--- a/libpurple/plugins/perl/common/Server.xs	Sat Sep 04 17:47:46 2010 +0000
+++ b/libpurple/plugins/perl/common/Server.xs	Sun Sep 05 01:30:56 2010 +0000
@@ -144,6 +144,7 @@
 		g_hash_table_insert(t_GHash, t_key, t_value);
 	}
 	serv_join_chat(conn, t_GHash);
+	g_hash_table_destroy(t_GHash);
 
 void 
 serv_move_buddy(buddy, group1, group2)