diff libpurple/plugins/perl/common/BuddyList.xs @ 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 521cb9430f22 3828a61c44da
line wrap: on
line diff
--- 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