comparison src/perl.c @ 4349:0c68d402f59f

[gaim-migrate @ 4614] XML Blist Gaim stores all the buddy lists in one big happy file now. You can order the buddies however you want, and they'll stay ordered that way. We can also store some per-buddy information now, which will be cool. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Sun, 19 Jan 2003 22:16:52 +0000
parents cddb50734169
children 5fb47ec9bfe4
comparison
equal deleted inserted replaced
4348:922b66840a51 4349:0c68d402f59f
633 XS (XS_GAIM_buddy_list) 633 XS (XS_GAIM_buddy_list)
634 { 634 {
635 struct gaim_connection *gc; 635 struct gaim_connection *gc;
636 struct buddy *buddy; 636 struct buddy *buddy;
637 struct group *g; 637 struct group *g;
638 GSList *list = NULL; 638 GSList *list = groups;
639 GSList *mem; 639 GSList *mem;
640 int i = 0; 640 int i = 0;
641 dXSARGS; 641 dXSARGS;
642 items = 0; 642 items = 0;
643 643
644 gc = (struct gaim_connection *)SvIV(ST(0)); 644 gc = (struct gaim_connection *)SvIV(ST(0));
645 if (g_slist_find(connections, gc))
646 list = gc->groups;
647 645
648 while (list) { 646 while (list) {
649 g = (struct group *)list->data; 647 g = (struct group *)list->data;
650 mem = g->members; 648 mem = g->members;
651 while (mem) { 649 while (mem) {
652 buddy = (struct buddy *)mem->data; 650 buddy = (struct buddy *)mem->data;
653 XST_mPV(i++, buddy->name); 651 if(buddy->user->gc == gc)
652 XST_mPV(i++, buddy->name);
654 mem = mem->next; 653 mem = mem->next;
655 } 654 }
656 list = g_slist_next(list); 655 list = g_slist_next(list);
657 } 656 }
658 XSRETURN(i); 657 XSRETURN(i);
661 XS (XS_GAIM_online_list) 660 XS (XS_GAIM_online_list)
662 { 661 {
663 struct gaim_connection *gc; 662 struct gaim_connection *gc;
664 struct buddy *b; 663 struct buddy *b;
665 struct group *g; 664 struct group *g;
666 GSList *list = NULL; 665 GSList *list = groups;
667 GSList *mem; 666 GSList *mem;
668 int i = 0; 667 int i = 0;
669 dXSARGS; 668 dXSARGS;
670 items = 0; 669 items = 0;
671 670
672 gc = (struct gaim_connection *)SvIV(ST(0)); 671 gc = (struct gaim_connection *)SvIV(ST(0));
673 if (g_slist_find(connections, gc))
674 list = gc->groups;
675 672
676 while (list) { 673 while (list) {
677 g = (struct group *)list->data; 674 g = (struct group *)list->data;
678 mem = g->members; 675 mem = g->members;
679 while (mem) { 676 while (mem) {
680 b = (struct buddy *)mem->data; 677 b = (struct buddy *)mem->data;
681 if (b->present) XST_mPV(i++, b->name); 678 if (b->user->gc == gc && b->present) XST_mPV(i++, b->name);
682 mem = mem->next; 679 mem = mem->next;
683 } 680 }
684 list = g_slist_next(list); 681 list = g_slist_next(list);
685 } 682 }
686 XSRETURN(i); 683 XSRETURN(i);
745 dXSARGS; 742 dXSARGS;
746 items = 0; 743 items = 0;
747 744
748 gc = (struct gaim_connection *)SvIV(ST(0)); 745 gc = (struct gaim_connection *)SvIV(ST(0));
749 if (g_slist_find(connections, gc)) 746 if (g_slist_find(connections, gc))
750 buddy = find_buddy(gc, SvPV(ST(1), junk)); 747 buddy = find_buddy(gc->user, SvPV(ST(1), junk));
751 748
752 if (!buddy) 749 if (!buddy)
753 XSRETURN(0); 750 XSRETURN(0);
754 XST_mPV(0, buddy->name); 751 XST_mPV(0, buddy->name);
755 XST_mPV(1, get_buddy_alias(buddy)); 752 XST_mPV(1, get_buddy_alias(buddy));