Mercurial > pidgin.yaz
annotate src/protocols/msn/group.h @ 9091:97a1fb329cd2
[gaim-migrate @ 9868]
Patch by Felipe Contreras (shx) to check first if we have a buddy already
in a group before trying to add it to the group.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Thu, 27 May 2004 08:04:11 +0000 |
parents | 06f57183e29f |
children | 502707ca1836 |
rev | line source |
---|---|
5518 | 1 /** |
2 * @file group.h 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 #ifndef _MSN_GROUP_H_ | |
23 #define _MSN_GROUP_H_ | |
24 | |
25 typedef struct _MsnGroup MsnGroup; | |
26 typedef struct _MsnGroups MsnGroups; | |
27 | |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
28 #include <stdio.h> |
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
29 |
5518 | 30 #include "session.h" |
31 #include "user.h" | |
32 | |
33 /** | |
34 * A group. | |
35 */ | |
36 struct _MsnGroup | |
37 { | |
38 size_t ref_count; /**< The reference count. */ | |
39 | |
40 MsnSession *session; /**< The MSN session. */ | |
41 | |
42 int id; /**< The group ID. */ | |
43 char *name; /**< The name of the group. */ | |
44 | |
45 MsnUsers *users; /**< The users in the group. */ | |
46 }; | |
47 | |
48 /** | |
49 * A list of groups. | |
50 */ | |
51 struct _MsnGroups | |
52 { | |
53 size_t count; /**< The number of groups. */ | |
54 | |
55 GList *groups; /**< The list of groups. */ | |
56 }; | |
57 | |
58 /**************************************************************************/ | |
59 /** @name Group API */ | |
60 /**************************************************************************/ | |
61 /*@{*/ | |
62 | |
63 /** | |
64 * Creates a new group structure. | |
65 * | |
66 * @param session The MSN session. | |
67 * @param id The group ID. | |
68 * @param name The name of the group. | |
69 * | |
70 * @return A new group structure. | |
71 */ | |
72 MsnGroup *msn_group_new(MsnSession *session, int id, const char *name); | |
73 | |
74 /** | |
75 * Destroys a group structure. | |
76 * | |
77 * @param group The group to destroy. | |
78 */ | |
79 void msn_group_destroy(MsnGroup *group); | |
80 | |
81 /** | |
82 * Increments the reference count on a group. | |
83 * | |
84 * @param group The group. | |
85 * | |
86 * @return @a group | |
87 */ | |
88 MsnGroup *msn_group_ref(MsnGroup *group); | |
89 | |
90 /** | |
91 * Decrements the reference count on a group. | |
92 * | |
93 * This will destroy the structure if the count hits 0. | |
94 * | |
95 * @param group The group. | |
96 * | |
97 * @return @a group, or @c NULL if the new count is 0. | |
98 */ | |
99 MsnGroup *msn_group_unref(MsnGroup *group); | |
100 | |
101 /** | |
102 * Sets the ID for a group. | |
103 * | |
104 * @param group The group. | |
105 * @param id The ID. | |
106 */ | |
107 void msn_group_set_id(MsnGroup *group, int id); | |
108 | |
109 /** | |
110 * Sets the name for a group. | |
111 * | |
112 * @param group The group. | |
113 * @param name The name. | |
114 */ | |
115 void msn_group_set_name(MsnGroup *group, const char *name); | |
116 | |
117 /** | |
118 * Returns the ID for a group. | |
119 * | |
120 * @param group The group. | |
121 * | |
122 * @return The ID. | |
123 */ | |
124 int msn_group_get_id(const MsnGroup *group); | |
125 | |
126 /** | |
127 * Returns the name for a group. | |
128 * | |
129 * @param group The group. | |
130 * | |
131 * @return The name. | |
132 */ | |
133 const char *msn_group_get_name(const MsnGroup *group); | |
134 | |
135 /** | |
136 * Adds a user to the group. | |
137 * | |
138 * @param group The group. | |
139 * @param user The user. | |
140 */ | |
141 void msn_group_add_user(MsnGroup *group, MsnUser *user); | |
142 | |
143 /** | |
144 * Removes a user from the group. | |
145 * | |
146 * @param group The group. | |
147 * @param user The user. | |
148 */ | |
149 void msn_group_remove_user(MsnGroup *group, MsnUser *user); | |
150 | |
151 /** | |
152 * Returns the users in a group. | |
153 * | |
154 * @param group The group. | |
155 * | |
156 * @return The list of users. | |
157 */ | |
158 MsnUsers *msn_group_get_users(const MsnGroup *group); | |
159 | |
160 /*@}*/ | |
161 | |
162 /**************************************************************************/ | |
163 /** @name Group List API */ | |
164 /**************************************************************************/ | |
165 /*@{*/ | |
166 | |
167 /** | |
168 * Creates a new MsnGroups structure. | |
169 * | |
170 * @return A new MsnGroups structure. | |
171 */ | |
172 MsnGroups *msn_groups_new(void); | |
173 | |
174 /** | |
175 * Destroys a groups list. | |
176 * | |
177 * @param groups The groups list. | |
178 */ | |
179 void msn_groups_destroy(MsnGroups *groups); | |
180 | |
181 /** | |
182 * Adds a group to a groups list. | |
183 * | |
184 * @param groups The groups list. | |
185 * @param group The group. | |
186 */ | |
187 void msn_groups_add(MsnGroups *groups, MsnGroup *group); | |
188 | |
189 /** | |
190 * Removes a group from a groups list. | |
191 * | |
192 * @param groups The groups list. | |
193 * @param group The group. | |
194 */ | |
195 void msn_groups_remove(MsnGroups *groups, MsnGroup *group); | |
196 | |
197 /** | |
198 * Returns the number of groups in a groups list. | |
199 * | |
200 * @param groups The groups list. | |
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
201 * |
5518 | 202 * @return The number of groups. |
203 */ | |
204 size_t msn_groups_get_count(const MsnGroups *groups); | |
205 | |
206 /** | |
207 * Finds a group with the specified ID. | |
208 * | |
209 * @param groups A list of groups. | |
210 * @param id The group ID. | |
211 * | |
212 * @return The group if found, or @c NULL otherwise. | |
213 */ | |
214 MsnGroup *msn_groups_find_with_id(MsnGroups *groups, int id); | |
215 | |
216 /** | |
217 * Returns a GList of all groups. | |
218 * | |
219 * @param groups The list of groups. | |
220 * | |
221 * @return A GList of all groups. | |
222 */ | |
223 GList *msn_groups_get_list(const MsnGroups *groups); | |
224 | |
225 /** | |
226 * Finds a group with the specified name. | |
227 * | |
228 * @param groups A list of groups. | |
229 * @param name The group name. | |
230 * | |
231 * @return The group if found, or @c NULL otherwise. | |
232 */ | |
233 MsnGroup *msn_groups_find_with_name(MsnGroups *groups, const char *name); | |
234 | |
235 #endif /* _MSN_GROUP_H_ */ |