diff src/perl.c @ 4770:c4c28874ecd3

[gaim-migrate @ 5088] I want to go to sleep. This is drag-n-drop moving of buddies in the list. I think it works, but I didn't actually test it... I really should have though; I can't imagine it working fine as-is. ;) I'm holding off on the rest of my Edit Buddy List stuff for tomorrow... I love last minute things, don't I? Note: I created gaim_blist_members and gaim_blist_groups to reproduce the effects of the old groups GSList and the members GSList of the group struct that I removed. This is really sub-optimal and should be replaced to iterate the Buddy List directly. If someone wants to do that, please do. Even if you don't want to do that, just review the changes I made and make sure I didn't do anything stupid. It is past 6am and I'm a bit tired and prone to mistake making. Thanks. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Fri, 14 Mar 2003 11:38:21 +0000
parents 283fb289c510
children 1e28e7d802a1
line wrap: on
line diff
--- a/src/perl.c	Fri Mar 14 08:27:13 2003 +0000
+++ b/src/perl.c	Fri Mar 14 11:38:21 2003 +0000
@@ -666,25 +666,27 @@
 	struct gaim_connection *gc;
 	struct buddy *buddy;
 	struct group *g;
-	GSList *list = groups;
-	GSList *mem;
+	GSList *list = gaim_blist_groups(), *list1 = list;
+	GSList *mem, *mem1;
 	int i = 0;
 	dXSARGS;
 	items = 0;
 
 	gc = (struct gaim_connection *)SvIV(ST(0));
 
-	while (list) {
-		g = (struct group *)list->data;
-		mem = g->members;
-		while (mem) {
-			buddy = (struct buddy *)mem->data;
+	while (list1) {
+		g = (struct group *)list1->data;
+		mem1 = mem = gaim_blist_members(g);
+		while (mem1) {
+			buddy = (struct buddy *)mem1->data;
 			if(buddy->account == gc->account)
 				XST_mPV(i++, buddy->name);
-			mem = mem->next;
+			mem1 = mem1->next;
 		}
-		list = g_slist_next(list);
+		g_slist_free(mem);
+		list1 = g_slist_next(list1);
 	}
+	g_slist_free(list);
 	XSRETURN(i);
 }
 
@@ -693,24 +695,27 @@
 	struct gaim_connection *gc;
 	struct buddy *b;
 	struct group *g;
-	GSList *list = groups;
-	GSList *mem;
+	GSList *list = gaim_blist_groups(), *list1 = list;
+	GSList *mem, *mem1;
 	int i = 0;
 	dXSARGS;
 	items = 0;
 
 	gc = (struct gaim_connection *)SvIV(ST(0));
 
-	while (list) {
-		g = (struct group *)list->data;
-		mem = g->members;
-		while (mem) {
-			b = (struct buddy *)mem->data;
+	while (list1) {
+		g = (struct group *)list1->data;
+		mem = gaim_blist_members(g);
+		mem1 = mem;
+		while (mem1) {
+			b = (struct buddy *)mem1->data;
 			if (b->account == gc->account && b->present) XST_mPV(i++, b->name);
-			mem = mem->next;
+			mem1 = mem1->next;
 		}
-		list = g_slist_next(list);
+		g_slist_free(mem);
+		list1 = g_slist_next(list1);
 	}
+	g_slist_free(list);
 	XSRETURN(i);
 }