Mercurial > pidgin.yaz
annotate src/protocols/msn/group.c @ 9193:502707ca1836
[gaim-migrate @ 9988]
Patch by Felipe Contreras to add MSN file transfer and buddy icons. Please
test and report any bugs!
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Sun, 06 Jun 2004 02:39:08 +0000 |
parents | 06f57183e29f |
children | ab6636c5a136 |
rev | line source |
---|---|
5518 | 1 /** |
2 * @file group.c Group functions | |
3 * | |
4 * gaim | |
5 * | |
8475
06f57183e29f
[gaim-migrate @ 9208]
Christian Hammond <chipx86@chipx86.com>
parents:
6701
diff
changeset
|
6 * Copyright (C) 2003-2004 Christian Hammond <chipx86@gnupdate.org> |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
7 * |
5518 | 8 * This program is free software; you can redistribute it and/or modify |
9 * it under the terms of the GNU General Public License as published by | |
10 * the Free Software Foundation; either version 2 of the License, or | |
11 * (at your option) any later version. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, | |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 * GNU General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU General Public License | |
19 * along with this program; if not, write to the Free Software | |
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
21 */ | |
22 #include "msn.h" | |
23 #include "group.h" | |
24 | |
25 MsnGroup * | |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
26 msn_group_new(MsnUserList *userlist, int id, const char *name) |
5518 | 27 { |
28 MsnGroup *group; | |
29 | |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
30 g_return_val_if_fail(id >= 0, NULL); |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
31 g_return_val_if_fail(name != NULL, NULL); |
5518 | 32 |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
33 group = g_new0(MsnGroup, 1); |
5518 | 34 |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
35 msn_userlist_add_group(userlist, group); |
5518 | 36 |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
37 group->id = id; |
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
38 group->name = g_strdup(name); |
5518 | 39 |
40 return group; | |
41 } | |
42 | |
43 void | |
44 msn_group_destroy(MsnGroup *group) | |
45 { | |
46 g_return_if_fail(group != NULL); | |
47 | |
48 g_free(group->name); | |
49 g_free(group); | |
50 } | |
51 | |
52 void | |
53 msn_group_set_id(MsnGroup *group, int id) | |
54 { | |
55 g_return_if_fail(group != NULL); | |
56 g_return_if_fail(id >= 0); | |
57 | |
58 group->id = id; | |
59 } | |
60 | |
61 void | |
62 msn_group_set_name(MsnGroup *group, const char *name) | |
63 { | |
64 g_return_if_fail(group != NULL); | |
65 g_return_if_fail(name != NULL); | |
66 | |
67 if (group->name != NULL) | |
68 g_free(group->name); | |
69 | |
70 group->name = g_strdup(name); | |
71 } | |
72 | |
73 int | |
74 msn_group_get_id(const MsnGroup *group) | |
75 { | |
76 g_return_val_if_fail(group != NULL, -1); | |
77 | |
78 return group->id; | |
79 } | |
80 | |
81 const char * | |
82 msn_group_get_name(const MsnGroup *group) | |
83 { | |
84 g_return_val_if_fail(group != NULL, NULL); | |
85 | |
86 return group->name; | |
87 } |