annotate plugins/perl/common/BuddyList_Group.xs @ 9285:7a8aa87164ae

[gaim-migrate @ 10088] Ok I'm done. This started out as shx's patch to make add/remove buddy/buddies take GaimBuddy and GaimGroup's in various places. I think his diff was like 2000 lines and mine is like 5000. I tried to clean up blist.c a bit and make it more uniform. There are some more g_return_if_fail() checks. Removed some code that was deprecated--it's probably been long enough. Removed some #include <multi.h>'s. Make blist.xml saving happen on a timer, like prefs.xml and accounts.xml. Sorry if this doesn't merge cleanly with whatever you're doing. People should really test this a lot. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Tue, 15 Jun 2004 02:37:27 +0000
parents 1d994e9b81f9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6542
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1 #include "module.h"
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3 MODULE = Gaim::BuddyList::Group PACKAGE = Gaim::BuddyList::Group PREFIX = gaim_group_
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4 PROTOTYPES: ENABLE
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6 Gaim::BuddyList::Group
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
7 new(name)
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
8 const char *name
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
9 CODE:
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
10 RETVAL = gaim_group_new(name);
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 OUTPUT:
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 RETVAL
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 void
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 rename(group, new_name)
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 Gaim::BuddyList::Group group
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 const char *new_name
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 CODE:
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 gaim_blist_rename_group(group, new_name);
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21 void
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22 get_accounts(group)
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
23 Gaim::BuddyList::Group group
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
24 PREINIT:
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
25 GSList *l;
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
26 PPCODE:
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
27 for (l = gaim_group_get_accounts(group); l != NULL; l = l->next)
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
28 XPUSHs(sv_2mortal(gaim_perl_bless_object(l->data, "Gaim::Account")));
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
29
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
30 int
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
31 get_size(group, offline)
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
32 Gaim::BuddyList::Group group
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
33 gboolean offline
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
34 CODE:
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
35 RETVAL = gaim_blist_get_group_size(group, offline);
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
36 OUTPUT:
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
37 RETVAL
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
38
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
39 const char *
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
40 get_name(group)
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
41 Gaim::BuddyList::Group group
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
42 CODE:
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
43 RETVAL = group->name;
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
44 OUTPUT:
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
45 RETVAL
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
46
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
47 int
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
48 get_online_count(group)
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
49 Gaim::BuddyList::Group group
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
50 CODE:
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
51 RETVAL = gaim_blist_get_group_online_count(group);
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
52 OUTPUT:
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
53 RETVAL
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
54
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
55 void
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
56 buddies(group)
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
57 Gaim::BuddyList::Group group
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
58 PREINIT:
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
59 GaimBlistNode *node;
6922
1d994e9b81f9 [gaim-migrate @ 7469]
Christian Hammond <chipx86@chipx86.com>
parents: 6542
diff changeset
60 GaimBlistNode *contact;
6542
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
61 GaimBlistNode *_group = (GaimBlistNode *)group;
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
62 PPCODE:
6922
1d994e9b81f9 [gaim-migrate @ 7469]
Christian Hammond <chipx86@chipx86.com>
parents: 6542
diff changeset
63 for (contact = _group->child; contact != NULL; contact = contact->next)
6542
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
64 {
6922
1d994e9b81f9 [gaim-migrate @ 7469]
Christian Hammond <chipx86@chipx86.com>
parents: 6542
diff changeset
65 for (node = contact->child; node != NULL; node = node->next)
1d994e9b81f9 [gaim-migrate @ 7469]
Christian Hammond <chipx86@chipx86.com>
parents: 6542
diff changeset
66 {
1d994e9b81f9 [gaim-migrate @ 7469]
Christian Hammond <chipx86@chipx86.com>
parents: 6542
diff changeset
67 XPUSHs(sv_2mortal(gaim_perl_bless_object(node,
1d994e9b81f9 [gaim-migrate @ 7469]
Christian Hammond <chipx86@chipx86.com>
parents: 6542
diff changeset
68 "Gaim::BuddyList::Buddy")));
1d994e9b81f9 [gaim-migrate @ 7469]
Christian Hammond <chipx86@chipx86.com>
parents: 6542
diff changeset
69 }
6542
fe0294504602 [gaim-migrate @ 7064]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
70 }
6922
1d994e9b81f9 [gaim-migrate @ 7469]
Christian Hammond <chipx86@chipx86.com>
parents: 6542
diff changeset
71