changeset 30490:0149f914962e

perl: Wrap purple_chat_get_components
author Paul Aurich <paul@darkrain42.org>
date Mon, 06 Sep 2010 03:46:24 +0000
parents a2d5bafdbea9
children 5b8347284660
files ChangeLog.API libpurple/plugins/perl/common/BuddyList.xs
diffstat 2 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog.API	Sun Sep 05 01:30:56 2010 +0000
+++ b/ChangeLog.API	Mon Sep 06 03:46:24 2010 +0000
@@ -2,6 +2,9 @@
 
 version 2.7.4 (MM/DD/YYYY):
 	Perl:
+		Added:
+		* Purple::BuddyList::Chat::get_components
+
 		Changed:
 		* Purple::BuddyList::Chat::new now works properly.  Thanks
 		  to Rafael in devel@conference.pidgin.im for reporting and
--- a/libpurple/plugins/perl/common/BuddyList.xs	Sun Sep 05 01:30:56 2010 +0000
+++ b/libpurple/plugins/perl/common/BuddyList.xs	Mon Sep 06 03:46:24 2010 +0000
@@ -2,6 +2,13 @@
 #include "module.h"
 #include "../perl-handlers.h"
 
+static void
+chat_components_foreach(gpointer key, gpointer value, gpointer user_data)
+{
+	HV *hv = user_data;
+	hv_store(hv, key, strlen(key), newSVpv(value, 0), 0);
+}
+
 MODULE = Purple::BuddyList  PACKAGE = Purple  PREFIX = purple_
 PROTOTYPES: ENABLE
 
@@ -331,6 +338,19 @@
 purple_chat_get_name(chat)
 	Purple::BuddyList::Chat chat
 
+HV *
+purple_chat_get_components(chat)
+	Purple::BuddyList::Chat chat
+INIT:
+	HV * t_HV;
+	GHashTable * t_GHash;
+CODE:
+	t_GHash = purple_chat_get_components(chat);
+	RETVAL = t_HV = newHV();
+	g_hash_table_foreach(t_GHash, chat_components_foreach, t_HV);
+OUTPUT:
+	RETVAL
+
 Purple::BuddyList::Chat
 purple_chat_new(account, alias, components)
 	Purple::Account account