annotate src/protocols/msn/group.c @ 12370:0d4484b7a46a

[gaim-migrate @ 14674] Changing the prototypes here broke FreeBSD. Looking at what was changed, I think reverting the changes for this file is best. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Tue, 06 Dec 2005 07:59:07 +0000
parents ab6636c5a136
children 852b32710df0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5518
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1 /**
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2 * @file group.c Group functions
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3 *
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4 * gaim
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5 *
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
6 * Gaim is the legal property of its developers, whose names are too numerous
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
7 * to list here. Please refer to the COPYRIGHT file distributed with this
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
8 * source distribution.
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 5518
diff changeset
9 *
5518
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
10 * This program is free software; you can redistribute it and/or modify
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 * it under the terms of the GNU General Public License as published by
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 * the Free Software Foundation; either version 2 of the License, or
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 * (at your option) any later version.
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 *
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 * This program is distributed in the hope that it will be useful,
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 * GNU General Public License for more details.
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 *
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 * You should have received a copy of the GNU General Public License
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21 * along with this program; if not, write to the Free Software
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
23 */
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
24 #include "msn.h"
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
25 #include "group.h"
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
26
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
27 MsnGroup *
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents: 8475
diff changeset
28 msn_group_new(MsnUserList *userlist, int id, const char *name)
5518
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
29 {
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
30 MsnGroup *group;
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
31
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents: 8475
diff changeset
32 g_return_val_if_fail(id >= 0, NULL);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents: 8475
diff changeset
33 g_return_val_if_fail(name != NULL, NULL);
5518
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
34
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents: 8475
diff changeset
35 group = g_new0(MsnGroup, 1);
5518
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
36
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents: 8475
diff changeset
37 msn_userlist_add_group(userlist, group);
5518
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
38
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents: 8475
diff changeset
39 group->id = id;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents: 8475
diff changeset
40 group->name = g_strdup(name);
5518
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
41
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
42 return group;
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
43 }
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
44
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
45 void
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
46 msn_group_destroy(MsnGroup *group)
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
47 {
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
48 g_return_if_fail(group != NULL);
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
49
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
50 g_free(group->name);
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
51 g_free(group);
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
52 }
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
53
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
54 void
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
55 msn_group_set_id(MsnGroup *group, int id)
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
56 {
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
57 g_return_if_fail(group != NULL);
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
58 g_return_if_fail(id >= 0);
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
59
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
60 group->id = id;
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
61 }
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
62
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
63 void
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
64 msn_group_set_name(MsnGroup *group, const char *name)
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
65 {
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
66 g_return_if_fail(group != NULL);
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
67 g_return_if_fail(name != NULL);
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
68
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
69 if (group->name != NULL)
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
70 g_free(group->name);
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
71
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
72 group->name = g_strdup(name);
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
73 }
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
74
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
75 int
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
76 msn_group_get_id(const MsnGroup *group)
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
77 {
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
78 g_return_val_if_fail(group != NULL, -1);
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
79
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
80 return group->id;
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
81 }
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
82
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
83 const char *
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
84 msn_group_get_name(const MsnGroup *group)
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
85 {
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
86 g_return_val_if_fail(group != NULL, NULL);
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
87
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
88 return group->name;
bf2a7a7b739d [gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
89 }