comparison libpurple/protocols/msnp9/group.c @ 21312:a07cfce78345

Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly old fools like me who prefer the stability of our MSNP9 code over the features of MSNP14 can enable this using the --disable-msnp14 ./configure option. If we want to release from i.p.p and MSN stability is the only blocker, we can trivially flick the default to use MSNP9 in configure.ac
author Stu Tomlinson <stu@nosnilmot.com>
date Sun, 11 Nov 2007 12:57:52 +0000
parents
children
comparison
equal deleted inserted replaced
21311:7d031cec5ba2 21312:a07cfce78345
1 /**
2 * @file group.c Group functions
3 *
4 * purple
5 *
6 * Purple is the legal property of its developers, whose names are too numerous
7 * to list here. Please refer to the COPYRIGHT file distributed with this
8 * source distribution.
9 *
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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
23 */
24 #include "msn.h"
25 #include "group.h"
26
27 MsnGroup *
28 msn_group_new(MsnUserList *userlist, int id, const char *name)
29 {
30 MsnGroup *group;
31
32 g_return_val_if_fail(id >= 0, NULL);
33 g_return_val_if_fail(name != NULL, NULL);
34
35 group = g_new0(MsnGroup, 1);
36
37 msn_userlist_add_group(userlist, group);
38
39 group->id = id;
40 group->name = g_strdup(name);
41
42 return group;
43 }
44
45 void
46 msn_group_destroy(MsnGroup *group)
47 {
48 g_return_if_fail(group != NULL);
49
50 g_free(group->name);
51 g_free(group);
52 }
53
54 void
55 msn_group_set_id(MsnGroup *group, int id)
56 {
57 g_return_if_fail(group != NULL);
58 g_return_if_fail(id >= 0);
59
60 group->id = id;
61 }
62
63 void
64 msn_group_set_name(MsnGroup *group, const char *name)
65 {
66 g_return_if_fail(group != NULL);
67 g_return_if_fail(name != NULL);
68
69 if (group->name != NULL)
70 g_free(group->name);
71
72 group->name = g_strdup(name);
73 }
74
75 int
76 msn_group_get_id(const MsnGroup *group)
77 {
78 g_return_val_if_fail(group != NULL, -1);
79
80 return group->id;
81 }
82
83 const char *
84 msn_group_get_name(const MsnGroup *group)
85 {
86 g_return_val_if_fail(group != NULL, NULL);
87
88 return group->name;
89 }