Mercurial > pidgin.yaz
annotate src/protocols/msn/group.c @ 19785:ea8b7028e8bb
[gaim-migrate @ 17057]
fix contact delete bug:
when Send ADL,NS disconnect.<fix the add/delte XML format>
committed by MaYuan<mayuan2006@gmail.com>
committer: Ethan Blanton <elb@pidgin.im>
author | Ma Yuan <mayuan2006@gmail.com> |
---|---|
date | Sun, 27 Aug 2006 11:45:02 +0000 |
parents | 852b32710df0 |
children | 54f287047d4e |
rev | line source |
---|---|
5518 | 1 /** |
2 * @file group.c Group functions | |
3 * | |
4 * gaim | |
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 | 10 * This program is free software; you can redistribute it and/or modify |
11 * it under the terms of the GNU General Public License as published by | |
12 * the Free Software Foundation; either version 2 of the License, or | |
13 * (at your option) any later version. | |
14 * | |
15 * This program is distributed in the hope that it will be useful, | |
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 * GNU General Public License for more details. | |
19 * | |
20 * You should have received a copy of the GNU General Public License | |
21 * along with this program; if not, write to the Free Software | |
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
23 */ | |
24 #include "msn.h" | |
25 #include "group.h" | |
26 | |
27 MsnGroup * | |
19739 | 28 msn_group_new(MsnUserList *userlist, const char *id, const char *name) |
5518 | 29 { |
30 MsnGroup *group; | |
31 | |
19739 | 32 g_return_val_if_fail(id != NULL, NULL); |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
33 g_return_val_if_fail(name != NULL, NULL); |
5518 | 34 |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
35 group = g_new0(MsnGroup, 1); |
5518 | 36 |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
37 msn_userlist_add_group(userlist, group); |
5518 | 38 |
19739 | 39 group->id = g_strdup(id); |
9193
502707ca1836
[gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
8475
diff
changeset
|
40 group->name = g_strdup(name); |
5518 | 41 |
42 return group; | |
43 } | |
44 | |
45 void | |
46 msn_group_destroy(MsnGroup *group) | |
47 { | |
48 g_return_if_fail(group != NULL); | |
49 | |
19739 | 50 g_free(group->id); |
5518 | 51 g_free(group->name); |
52 g_free(group); | |
53 } | |
54 | |
55 void | |
19739 | 56 msn_group_set_id(MsnGroup *group, const char *id) |
5518 | 57 { |
58 g_return_if_fail(group != NULL); | |
19739 | 59 g_return_if_fail(id != NULL); |
5518 | 60 |
19739 | 61 group->id = g_strdup(id); |
5518 | 62 } |
63 | |
64 void | |
65 msn_group_set_name(MsnGroup *group, const char *name) | |
66 { | |
67 g_return_if_fail(group != NULL); | |
68 g_return_if_fail(name != NULL); | |
69 | |
70 if (group->name != NULL) | |
71 g_free(group->name); | |
72 | |
73 group->name = g_strdup(name); | |
74 } | |
75 | |
19739 | 76 char* |
5518 | 77 msn_group_get_id(const MsnGroup *group) |
78 { | |
79 g_return_val_if_fail(group != NULL, -1); | |
80 | |
81 return group->id; | |
82 } | |
83 | |
84 const char * | |
85 msn_group_get_name(const MsnGroup *group) | |
86 { | |
87 g_return_val_if_fail(group != NULL, NULL); | |
88 | |
89 return group->name; | |
90 } | |
19739 | 91 |