comparison libpurple/roomlist.h @ 32672:3828a61c44da

A boring and large patch so I can merge heads.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Fri, 23 Dec 2011 08:21:58 +0000
parents bf088afdc813
children
comparison
equal deleted inserted replaced
32671:0e69949b3e61 32672:3828a61c44da
60 #include <glib.h> 60 #include <glib.h>
61 61
62 /**************************************************************************/ 62 /**************************************************************************/
63 /** Data Structures */ 63 /** Data Structures */
64 /**************************************************************************/ 64 /**************************************************************************/
65
66 /**
67 * Represents a list of rooms for a given connection on a given protocol.
68 */
69 struct _PurpleRoomlist {
70 PurpleAccount *account; /**< The account this list belongs to. */
71 GList *fields; /**< The fields. */
72 GList *rooms; /**< The list of rooms. */
73 gboolean in_progress; /**< The listing is in progress. */
74 gpointer ui_data; /**< UI private data. */
75 gpointer proto_data; /** Prpl private data. */
76 guint ref; /**< The reference count. */
77 };
78
79 /**
80 * Represents a room.
81 */
82 struct _PurpleRoomlistRoom {
83 PurpleRoomlistRoomType type; /**< The type of room. */
84 gchar *name; /**< The name of the room. */
85 GList *fields; /**< Other fields. */
86 PurpleRoomlistRoom *parent; /**< The parent room, or NULL. */
87 gboolean expanded_once; /**< A flag the UI uses to avoid multiple expand prpl cbs. */
88 };
89
90 /**
91 * A field a room might have.
92 */
93 struct _PurpleRoomlistField {
94 PurpleRoomlistFieldType type; /**< The type of field. */
95 gchar *label; /**< The i18n user displayed name of the field. */
96 gchar *name; /**< The internal name of the field. */
97 gboolean hidden; /**< Hidden? */
98 };
99 65
100 /** 66 /**
101 * The room list ops to be filled out by the UI. 67 * The room list ops to be filled out by the UI.
102 */ 68 */
103 struct _PurpleRoomlistUiOps { 69 struct _PurpleRoomlistUiOps {
161 * destroy. 127 * destroy.
162 */ 128 */
163 void purple_roomlist_unref(PurpleRoomlist *list); 129 void purple_roomlist_unref(PurpleRoomlist *list);
164 130
165 /** 131 /**
132 * Retrieve the PurpleAccount that was given when the room list was
133 * created.
134 *
135 * @return The PurpleAccount tied to this room list.
136 */
137 PurpleAccount *purple_roomlist_get_account(PurpleRoomlist *list);
138
139 /**
166 * Set the different field types and their names for this protocol. 140 * Set the different field types and their names for this protocol.
167 * 141 *
168 * This must be called before purple_roomlist_room_add(). 142 * This must be called before purple_roomlist_room_add().
169 * 143 *
170 * @param list The room list. 144 * @param list The room list.
239 void purple_roomlist_expand_category(PurpleRoomlist *list, PurpleRoomlistRoom *category); 213 void purple_roomlist_expand_category(PurpleRoomlist *list, PurpleRoomlistRoom *category);
240 214
241 /** 215 /**
242 * Get the list of fields for a roomlist. 216 * Get the list of fields for a roomlist.
243 * 217 *
244 * @param roomlist The roomlist, which must not be @c NULL. 218 * @param roomlist The roomlist, which must not be @c NULL.
245 * @constreturn A list of fields 219 * @constreturn A list of fields
246 * @since 2.4.0 220 */
247 */ 221 GList *purple_roomlist_get_fields(PurpleRoomlist *roomlist);
248 GList * purple_roomlist_get_fields(PurpleRoomlist *roomlist); 222
223 /**
224 * Get the protocol data associated with this room list.
225 *
226 * @param list The roomlist, which must not be @c NULL.
227 *
228 * @return The protocol data associated with this room list. This is a
229 * convenience field provided to the protocol plugin--it is not
230 * used the libpurple core.
231 */
232 gpointer purple_roomlist_get_proto_data(PurpleRoomlist *list);
233
234 /**
235 * Set the protocol data associated with this room list.
236 *
237 * @param list The roomlist, which must not be @c NULL.
238 * @param proto_data A pointer to associate with this room list.
239 */
240 void purple_roomlist_set_proto_data(PurpleRoomlist *list, gpointer proto_data);
241
242 /**
243 * Get the UI data associated with this room list.
244 *
245 * @param list The roomlist, which must not be @c NULL.
246 *
247 * @return The UI data associated with this room list. This is a
248 * convenience field provided to the UIs--it is not
249 * used by the libpurple core.
250 */
251 gpointer purple_roomlist_get_ui_data(PurpleRoomlist *list);
252
253 /**
254 * Set the UI data associated with this room list.
255 *
256 * @param list The roomlist, which must not be @c NULL.
257 * @param ui_data A pointer to associate with this room list.
258 */
259 void purple_roomlist_set_ui_data(PurpleRoomlist *list, gpointer ui_data);
249 260
250 /*@}*/ 261 /*@}*/
251 262
252 /**************************************************************************/ 263 /**************************************************************************/
253 /** @name Room API */ 264 /** @name Room API */
285 296
286 /** 297 /**
287 * Get the type of a room. 298 * Get the type of a room.
288 * @param room The room, which must not be @c NULL. 299 * @param room The room, which must not be @c NULL.
289 * @return The type of the room. 300 * @return The type of the room.
290 * @since 2.4.0
291 */ 301 */
292 PurpleRoomlistRoomType purple_roomlist_room_get_type(PurpleRoomlistRoom *room); 302 PurpleRoomlistRoomType purple_roomlist_room_get_type(PurpleRoomlistRoom *room);
293 303
294 /** 304 /**
295 * Get the name of a room. 305 * Get the name of a room.
296 * @param room The room, which must not be @c NULL. 306 * @param room The room, which must not be @c NULL.
297 * @return The name of the room. 307 * @return The name of the room.
298 * @since 2.4.0
299 */ 308 */
300 const char * purple_roomlist_room_get_name(PurpleRoomlistRoom *room); 309 const char * purple_roomlist_room_get_name(PurpleRoomlistRoom *room);
301 310
302 /** 311 /**
303 * Get the parent of a room. 312 * Get the parent of a room.
304 * @param room The room, which must not be @c NULL. 313 * @param room The room, which must not be @c NULL.
305 * @return The parent of the room, which can be @c NULL. 314 * @return The parent of the room, which can be @c NULL.
306 * @since 2.4.0
307 */ 315 */
308 PurpleRoomlistRoom * purple_roomlist_room_get_parent(PurpleRoomlistRoom *room); 316 PurpleRoomlistRoom * purple_roomlist_room_get_parent(PurpleRoomlistRoom *room);
317
318 /**
319 * Get the value of the expanded_once flag.
320 *
321 * @param room The room, which must not be @c NULL.
322 *
323 * @return The value of the expanded_once flag.
324 */
325 gboolean purple_roomlist_room_get_expanded_once(PurpleRoomlistRoom *room);
326
327 /**
328 * Set the expanded_once flag.
329 *
330 * @param room The room, which must not be @c NULL.
331 * @param expanded_once The new value of the expanded_once flag.
332 */
333 void purple_roomlist_room_set_expanded_once(PurpleRoomlistRoom *room, gboolean expanded_once);
309 334
310 /** 335 /**
311 * Get the list of fields for a room. 336 * Get the list of fields for a room.
312 * 337 *
313 * @param room The room, which must not be @c NULL. 338 * @param room The room, which must not be @c NULL.
314 * @constreturn A list of fields 339 * @constreturn A list of fields
315 * @since 2.4.0
316 */ 340 */
317 GList * purple_roomlist_room_get_fields(PurpleRoomlistRoom *room); 341 GList * purple_roomlist_room_get_fields(PurpleRoomlistRoom *room);
318 342
319 /*@}*/ 343 /*@}*/
320 344
342 * Get the type of a field. 366 * Get the type of a field.
343 * 367 *
344 * @param field A PurpleRoomlistField, which must not be @c NULL. 368 * @param field A PurpleRoomlistField, which must not be @c NULL.
345 * 369 *
346 * @return The type of the field. 370 * @return The type of the field.
347 * @since 2.4.0
348 */ 371 */
349 PurpleRoomlistFieldType purple_roomlist_field_get_type(PurpleRoomlistField *field); 372 PurpleRoomlistFieldType purple_roomlist_field_get_type(PurpleRoomlistField *field);
350 373
351 /** 374 /**
352 * Get the label of a field. 375 * Get the label of a field.
353 * 376 *
354 * @param field A PurpleRoomlistField, which must not be @c NULL. 377 * @param field A PurpleRoomlistField, which must not be @c NULL.
355 * 378 *
356 * @return The label of the field. 379 * @return The label of the field.
357 * @since 2.4.0
358 */ 380 */
359 const char * purple_roomlist_field_get_label(PurpleRoomlistField *field); 381 const char * purple_roomlist_field_get_label(PurpleRoomlistField *field);
360 382
361 /** 383 /**
362 * Check whether a roomlist-field is hidden. 384 * Check whether a roomlist-field is hidden.
363 * @param field A PurpleRoomlistField, which must not be @c NULL. 385 * @param field A PurpleRoomlistField, which must not be @c NULL.
364 * 386 *
365 * @return @c TRUE if the field is hidden, @c FALSE otherwise. 387 * @return @c TRUE if the field is hidden, @c FALSE otherwise.
366 * @since 2.4.0
367 */ 388 */
368 gboolean purple_roomlist_field_get_hidden(PurpleRoomlistField *field); 389 gboolean purple_roomlist_field_get_hidden(PurpleRoomlistField *field);
369 390
370 /*@}*/ 391 /*@}*/
371 392