comparison libpurple/roomlist.h @ 32819:2c6510167895 default tip

propagate from branch 'im.pidgin.pidgin.2.x.y' (head 3315c5dfbd0ad16511bdcf865e5b07c02d07df24) to branch 'im.pidgin.pidgin' (head cbd1eda6bcbf0565ae7766396bb8f6f419cb6a9a)
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sat, 02 Jun 2012 02:30:49 +0000
parents 98520ee78f12
children
comparison
equal deleted inserted replaced
32818:01ff09d4a463 32819:2c6510167895
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 {
113 void (*_purple_reserved3)(void); 79 void (*_purple_reserved3)(void);
114 void (*_purple_reserved4)(void); 80 void (*_purple_reserved4)(void);
115 }; 81 };
116 82
117 83
118 #ifdef __cplusplus 84 G_BEGIN_DECLS
119 extern "C" {
120 #endif
121 85
122 /**************************************************************************/ 86 /**************************************************************************/
123 /** @name Room List API */ 87 /** @name Room List API */
124 /**************************************************************************/ 88 /**************************************************************************/
125 /*@{*/ 89 /*@{*/
161 * destroy. 125 * destroy.
162 */ 126 */
163 void purple_roomlist_unref(PurpleRoomlist *list); 127 void purple_roomlist_unref(PurpleRoomlist *list);
164 128
165 /** 129 /**
130 * Retrieve the PurpleAccount that was given when the room list was
131 * created.
132 *
133 * @return The PurpleAccount tied to this room list.
134 */
135 PurpleAccount *purple_roomlist_get_account(PurpleRoomlist *list);
136
137 /**
166 * Set the different field types and their names for this protocol. 138 * Set the different field types and their names for this protocol.
167 * 139 *
168 * This must be called before purple_roomlist_room_add(). 140 * This must be called before purple_roomlist_room_add().
169 * 141 *
170 * @param list The room list. 142 * @param list The room list.
239 void purple_roomlist_expand_category(PurpleRoomlist *list, PurpleRoomlistRoom *category); 211 void purple_roomlist_expand_category(PurpleRoomlist *list, PurpleRoomlistRoom *category);
240 212
241 /** 213 /**
242 * Get the list of fields for a roomlist. 214 * Get the list of fields for a roomlist.
243 * 215 *
244 * @param roomlist The roomlist, which must not be @c NULL. 216 * @param roomlist The roomlist, which must not be @c NULL.
245 * @constreturn A list of fields 217 * @constreturn A list of fields
246 * @since 2.4.0 218 */
247 */ 219 GList *purple_roomlist_get_fields(PurpleRoomlist *roomlist);
248 GList * purple_roomlist_get_fields(PurpleRoomlist *roomlist); 220
221 /**
222 * Get the protocol data associated with this room list.
223 *
224 * @param list The roomlist, which must not be @c NULL.
225 *
226 * @return The protocol data associated with this room list. This is a
227 * convenience field provided to the protocol plugin--it is not
228 * used the libpurple core.
229 */
230 gpointer purple_roomlist_get_proto_data(PurpleRoomlist *list);
231
232 /**
233 * Set the protocol data associated with this room list.
234 *
235 * @param list The roomlist, which must not be @c NULL.
236 * @param proto_data A pointer to associate with this room list.
237 */
238 void purple_roomlist_set_proto_data(PurpleRoomlist *list, gpointer proto_data);
239
240 /**
241 * Get the UI data associated with this room list.
242 *
243 * @param list The roomlist, which must not be @c NULL.
244 *
245 * @return The UI data associated with this room list. This is a
246 * convenience field provided to the UIs--it is not
247 * used by the libpurple core.
248 */
249 gpointer purple_roomlist_get_ui_data(PurpleRoomlist *list);
250
251 /**
252 * Set the UI data associated with this room list.
253 *
254 * @param list The roomlist, which must not be @c NULL.
255 * @param ui_data A pointer to associate with this room list.
256 */
257 void purple_roomlist_set_ui_data(PurpleRoomlist *list, gpointer ui_data);
249 258
250 /*@}*/ 259 /*@}*/
251 260
252 /**************************************************************************/ 261 /**************************************************************************/
253 /** @name Room API */ 262 /** @name Room API */
285 294
286 /** 295 /**
287 * Get the type of a room. 296 * Get the type of a room.
288 * @param room The room, which must not be @c NULL. 297 * @param room The room, which must not be @c NULL.
289 * @return The type of the room. 298 * @return The type of the room.
290 * @since 2.4.0
291 */ 299 */
292 PurpleRoomlistRoomType purple_roomlist_room_get_type(PurpleRoomlistRoom *room); 300 PurpleRoomlistRoomType purple_roomlist_room_get_type(PurpleRoomlistRoom *room);
293 301
294 /** 302 /**
295 * Get the name of a room. 303 * Get the name of a room.
296 * @param room The room, which must not be @c NULL. 304 * @param room The room, which must not be @c NULL.
297 * @return The name of the room. 305 * @return The name of the room.
298 * @since 2.4.0
299 */ 306 */
300 const char * purple_roomlist_room_get_name(PurpleRoomlistRoom *room); 307 const char * purple_roomlist_room_get_name(PurpleRoomlistRoom *room);
301 308
302 /** 309 /**
303 * Get the parent of a room. 310 * Get the parent of a room.
304 * @param room The room, which must not be @c NULL. 311 * @param room The room, which must not be @c NULL.
305 * @return The parent of the room, which can be @c NULL. 312 * @return The parent of the room, which can be @c NULL.
306 * @since 2.4.0
307 */ 313 */
308 PurpleRoomlistRoom * purple_roomlist_room_get_parent(PurpleRoomlistRoom *room); 314 PurpleRoomlistRoom * purple_roomlist_room_get_parent(PurpleRoomlistRoom *room);
315
316 /**
317 * Get the value of the expanded_once flag.
318 *
319 * @param room The room, which must not be @c NULL.
320 *
321 * @return The value of the expanded_once flag.
322 */
323 gboolean purple_roomlist_room_get_expanded_once(PurpleRoomlistRoom *room);
324
325 /**
326 * Set the expanded_once flag.
327 *
328 * @param room The room, which must not be @c NULL.
329 * @param expanded_once The new value of the expanded_once flag.
330 */
331 void purple_roomlist_room_set_expanded_once(PurpleRoomlistRoom *room, gboolean expanded_once);
309 332
310 /** 333 /**
311 * Get the list of fields for a room. 334 * Get the list of fields for a room.
312 * 335 *
313 * @param room The room, which must not be @c NULL. 336 * @param room The room, which must not be @c NULL.
314 * @constreturn A list of fields 337 * @constreturn A list of fields
315 * @since 2.4.0
316 */ 338 */
317 GList * purple_roomlist_room_get_fields(PurpleRoomlistRoom *room); 339 GList * purple_roomlist_room_get_fields(PurpleRoomlistRoom *room);
318 340
319 /*@}*/ 341 /*@}*/
320 342
342 * Get the type of a field. 364 * Get the type of a field.
343 * 365 *
344 * @param field A PurpleRoomlistField, which must not be @c NULL. 366 * @param field A PurpleRoomlistField, which must not be @c NULL.
345 * 367 *
346 * @return The type of the field. 368 * @return The type of the field.
347 * @since 2.4.0
348 */ 369 */
349 PurpleRoomlistFieldType purple_roomlist_field_get_type(PurpleRoomlistField *field); 370 PurpleRoomlistFieldType purple_roomlist_field_get_type(PurpleRoomlistField *field);
350 371
351 /** 372 /**
352 * Get the label of a field. 373 * Get the label of a field.
353 * 374 *
354 * @param field A PurpleRoomlistField, which must not be @c NULL. 375 * @param field A PurpleRoomlistField, which must not be @c NULL.
355 * 376 *
356 * @return The label of the field. 377 * @return The label of the field.
357 * @since 2.4.0
358 */ 378 */
359 const char * purple_roomlist_field_get_label(PurpleRoomlistField *field); 379 const char * purple_roomlist_field_get_label(PurpleRoomlistField *field);
360 380
361 /** 381 /**
362 * Check whether a roomlist-field is hidden. 382 * Check whether a roomlist-field is hidden.
363 * @param field A PurpleRoomlistField, which must not be @c NULL. 383 * @param field A PurpleRoomlistField, which must not be @c NULL.
364 * 384 *
365 * @return @c TRUE if the field is hidden, @c FALSE otherwise. 385 * @return @c TRUE if the field is hidden, @c FALSE otherwise.
366 * @since 2.4.0
367 */ 386 */
368 gboolean purple_roomlist_field_get_hidden(PurpleRoomlistField *field); 387 gboolean purple_roomlist_field_get_hidden(PurpleRoomlistField *field);
369 388
370 /*@}*/ 389 /*@}*/
371 390
389 */ 408 */
390 PurpleRoomlistUiOps *purple_roomlist_get_ui_ops(void); 409 PurpleRoomlistUiOps *purple_roomlist_get_ui_ops(void);
391 410
392 /*@}*/ 411 /*@}*/
393 412
394 #ifdef __cplusplus 413 G_END_DECLS
395 }
396 #endif
397 414
398 #endif /* _PURPLE_ROOMLIST_H_ */ 415 #endif /* _PURPLE_ROOMLIST_H_ */