src/perl.c

changeset 4770
be590660a9c2
parent 4687
91ad36873636
child 4785
9af09a0b5ac1
equal deleted inserted replaced
4769:2e43531589fe 4770:be590660a9c2
664 XS (XS_GAIM_buddy_list) 664 XS (XS_GAIM_buddy_list)
665 { 665 {
666 struct gaim_connection *gc; 666 struct gaim_connection *gc;
667 struct buddy *buddy; 667 struct buddy *buddy;
668 struct group *g; 668 struct group *g;
669 GSList *list = groups; 669 GSList *list = gaim_blist_groups(), *list1 = list;
670 GSList *mem; 670 GSList *mem, *mem1;
671 int i = 0; 671 int i = 0;
672 dXSARGS; 672 dXSARGS;
673 items = 0; 673 items = 0;
674 674
675 gc = (struct gaim_connection *)SvIV(ST(0)); 675 gc = (struct gaim_connection *)SvIV(ST(0));
676 676
677 while (list) { 677 while (list1) {
678 g = (struct group *)list->data; 678 g = (struct group *)list1->data;
679 mem = g->members; 679 mem1 = mem = gaim_blist_members(g);
680 while (mem) { 680 while (mem1) {
681 buddy = (struct buddy *)mem->data; 681 buddy = (struct buddy *)mem1->data;
682 if(buddy->account == gc->account) 682 if(buddy->account == gc->account)
683 XST_mPV(i++, buddy->name); 683 XST_mPV(i++, buddy->name);
684 mem = mem->next; 684 mem1 = mem1->next;
685 } 685 }
686 list = g_slist_next(list); 686 g_slist_free(mem);
687 } 687 list1 = g_slist_next(list1);
688 }
689 g_slist_free(list);
688 XSRETURN(i); 690 XSRETURN(i);
689 } 691 }
690 692
691 XS (XS_GAIM_online_list) 693 XS (XS_GAIM_online_list)
692 { 694 {
693 struct gaim_connection *gc; 695 struct gaim_connection *gc;
694 struct buddy *b; 696 struct buddy *b;
695 struct group *g; 697 struct group *g;
696 GSList *list = groups; 698 GSList *list = gaim_blist_groups(), *list1 = list;
697 GSList *mem; 699 GSList *mem, *mem1;
698 int i = 0; 700 int i = 0;
699 dXSARGS; 701 dXSARGS;
700 items = 0; 702 items = 0;
701 703
702 gc = (struct gaim_connection *)SvIV(ST(0)); 704 gc = (struct gaim_connection *)SvIV(ST(0));
703 705
704 while (list) { 706 while (list1) {
705 g = (struct group *)list->data; 707 g = (struct group *)list1->data;
706 mem = g->members; 708 mem = gaim_blist_members(g);
707 while (mem) { 709 mem1 = mem;
708 b = (struct buddy *)mem->data; 710 while (mem1) {
711 b = (struct buddy *)mem1->data;
709 if (b->account == gc->account && b->present) XST_mPV(i++, b->name); 712 if (b->account == gc->account && b->present) XST_mPV(i++, b->name);
710 mem = mem->next; 713 mem1 = mem1->next;
711 } 714 }
712 list = g_slist_next(list); 715 g_slist_free(mem);
713 } 716 list1 = g_slist_next(list1);
717 }
718 g_slist_free(list);
714 XSRETURN(i); 719 XSRETURN(i);
715 } 720 }
716 721
717 XS (XS_GAIM_command) 722 XS (XS_GAIM_command)
718 { 723 {

mercurial