comparison src/protocols/msn/group.h @ 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
comparison
equal deleted inserted replaced
9192:5655dcd94d0f 9193:502707ca1836
21 */ 21 */
22 #ifndef _MSN_GROUP_H_ 22 #ifndef _MSN_GROUP_H_
23 #define _MSN_GROUP_H_ 23 #define _MSN_GROUP_H_
24 24
25 typedef struct _MsnGroup MsnGroup; 25 typedef struct _MsnGroup MsnGroup;
26 typedef struct _MsnGroups MsnGroups;
27 26
28 #include <stdio.h> 27 #include <stdio.h>
29 28
30 #include "session.h" 29 #include "session.h"
31 #include "user.h" 30 #include "user.h"
32 31
32 #include "userlist.h"
33
33 /** 34 /**
34 * A group. 35 * A group.
35 */ 36 */
36 struct _MsnGroup 37 struct _MsnGroup
37 { 38 {
38 size_t ref_count; /**< The reference count. */
39
40 MsnSession *session; /**< The MSN session. */ 39 MsnSession *session; /**< The MSN session. */
41 40
42 int id; /**< The group ID. */ 41 int id; /**< The group ID. */
43 char *name; /**< The name of the group. */ 42 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 }; 43 };
57 44
58 /**************************************************************************/ 45 /**************************************************************************/
59 /** @name Group API */ 46 /** @name Group API */
60 /**************************************************************************/ 47 /**************************************************************************/
67 * @param id The group ID. 54 * @param id The group ID.
68 * @param name The name of the group. 55 * @param name The name of the group.
69 * 56 *
70 * @return A new group structure. 57 * @return A new group structure.
71 */ 58 */
72 MsnGroup *msn_group_new(MsnSession *session, int id, const char *name); 59 MsnGroup *msn_group_new(MsnUserList *userlist, int id, const char *name);
73 60
74 /** 61 /**
75 * Destroys a group structure. 62 * Destroys a group structure.
76 * 63 *
77 * @param group The group to destroy. 64 * @param group The group to destroy.
78 */ 65 */
79 void msn_group_destroy(MsnGroup *group); 66 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 67
101 /** 68 /**
102 * Sets the ID for a group. 69 * Sets the ID for a group.
103 * 70 *
104 * @param group The group. 71 * @param group The group.
129 * @param group The group. 96 * @param group The group.
130 * 97 *
131 * @return The name. 98 * @return The name.
132 */ 99 */
133 const char *msn_group_get_name(const MsnGroup *group); 100 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.
201 *
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_ */ 101 #endif /* _MSN_GROUP_H_ */