roomlist.h
Go to the documentation of this file.
1
6 /* purple
7 *
8 * Purple is the legal property of its developers, whose names are too numerous
9 * to list here. Please refer to the COPYRIGHT file distributed with this
10 * source distribution.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
25 */
26
27 #ifndef _PURPLE_ROOMLIST_H_
28 #define _PURPLE_ROOMLIST_H_
29
30 typedef struct _PurpleRoomlist PurpleRoomlist;
31 typedef struct _PurpleRoomlistRoom PurpleRoomlistRoom;
32 typedef struct _PurpleRoomlistField PurpleRoomlistField;
34 typedef struct _PurpleRoomlistUiOps PurpleRoomlistUiOps;
35
41 typedef enum
42 {
43 PURPLE_ROOMLIST_ROOMTYPE_CATEGORY = 0x01,
44 PURPLE_ROOMLIST_ROOMTYPE_ROOM = 0x02
46 } PurpleRoomlistRoomType;
47
51 typedef enum
52 {
53 PURPLE_ROOMLIST_FIELD_BOOL,
54 PURPLE_ROOMLIST_FIELD_INT,
55 PURPLE_ROOMLIST_FIELD_STRING
57 } PurpleRoomlistFieldType;
58
59 #include "account.h"
60 #include <glib.h>
61
62 /**************************************************************************/
64 /**************************************************************************/
65
69 struct _PurpleRoomlist {
70 PurpleAccount *account;
71 GList *fields;
72 GList *rooms;
73 gboolean in_progress;
74 gpointer ui_data;
75 gpointer proto_data;
76 guint ref;
77 };
78
82 struct _PurpleRoomlistRoom {
83 PurpleRoomlistRoomType type;
84 gchar *name;
85 GList *fields;
86 PurpleRoomlistRoom *parent;
87 gboolean expanded_once;
88 };
89
93 struct _PurpleRoomlistField {
94 PurpleRoomlistFieldType type;
95 gchar *label;
96 gchar *name;
97 gboolean hidden;
98 };
99
103 struct _PurpleRoomlistUiOps {
104 void (*show_with_account)(PurpleAccount *account);
105 void (*create)(PurpleRoomlist *list);
106 void (*set_fields)(PurpleRoomlist *list, GList *fields);
107 void (*add_room)(PurpleRoomlist *list, PurpleRoomlistRoom *room);
108 void (*in_progress)(PurpleRoomlist *list, gboolean flag);
109 void (*destroy)(PurpleRoomlist *list);
111 void (*_purple_reserved1)(void);
112 void (*_purple_reserved2)(void);
113 void (*_purple_reserved3)(void);
114 void (*_purple_reserved4)(void);
115 };
116
117
118 #ifdef __cplusplus
119 extern "C" {
120 #endif
121
122 /**************************************************************************/
124 /**************************************************************************/
136 void purple_roomlist_show_with_account(PurpleAccount *account);
137
146 PurpleRoomlist *purple_roomlist_new(PurpleAccount *account);
147
153 void purple_roomlist_ref(PurpleRoomlist *list);
154
163 void purple_roomlist_unref(PurpleRoomlist *list);
164
174 void purple_roomlist_set_fields(PurpleRoomlist *list, GList *fields);
175
185 void purple_roomlist_set_in_progress(PurpleRoomlist *list, gboolean in_progress);
186
196 gboolean purple_roomlist_get_in_progress(PurpleRoomlist *list);
197
205 void purple_roomlist_room_add(PurpleRoomlist *list, PurpleRoomlistRoom *room);
206
216 PurpleRoomlist *purple_roomlist_get_list(PurpleConnection *gc);
217
226 void purple_roomlist_cancel_get_list(PurpleRoomlist *list);
227
239 void purple_roomlist_expand_category(PurpleRoomlist *list, PurpleRoomlistRoom *category);
240
248 GList * purple_roomlist_get_fields(PurpleRoomlist *roomlist);
249
252 /**************************************************************************/
254 /**************************************************************************/
266 PurpleRoomlistRoom *purple_roomlist_room_new(PurpleRoomlistRoomType type, const gchar *name,
267 PurpleRoomlistRoom *parent);
268
276 void purple_roomlist_room_add_field(PurpleRoomlist *list, PurpleRoomlistRoom *room, gconstpointer field);
277
284 void purple_roomlist_room_join(PurpleRoomlist *list, PurpleRoomlistRoom *room);
285
292 PurpleRoomlistRoomType purple_roomlist_room_get_type(PurpleRoomlistRoom *room);
293
300 const char * purple_roomlist_room_get_name(PurpleRoomlistRoom *room);
301
308 PurpleRoomlistRoom * purple_roomlist_room_get_parent(PurpleRoomlistRoom *room);
309
317 GList * purple_roomlist_room_get_fields(PurpleRoomlistRoom *room);
318
321 /**************************************************************************/
323 /**************************************************************************/
337 PurpleRoomlistField *purple_roomlist_field_new(PurpleRoomlistFieldType type,
338 const gchar *label, const gchar *name,
339 gboolean hidden);
340
349 PurpleRoomlistFieldType purple_roomlist_field_get_type(PurpleRoomlistField *field);
350
359 const char * purple_roomlist_field_get_label(PurpleRoomlistField *field);
360
368 gboolean purple_roomlist_field_get_hidden(PurpleRoomlistField *field);
369
372 /**************************************************************************/
374 /**************************************************************************/
382 void purple_roomlist_set_ui_ops(PurpleRoomlistUiOps *ops);
383
390 PurpleRoomlistUiOps *purple_roomlist_get_ui_ops(void);
391
394 #ifdef __cplusplus
395 }
396 #endif
397
398 #endif /* _PURPLE_ROOMLIST_H_ */
PurpleRoomlistFieldType
PurpleRoomlistFieldType
The types of fields.
Definition: roomlist.h:51
purple_roomlist_show_with_account
void purple_roomlist_show_with_account(PurpleAccount *account)
This is used to get the room list on an account, asking the UI to pop up a dialog with the specified ...
purple_roomlist_room_join
void purple_roomlist_room_join(PurpleRoomlist *list, PurpleRoomlistRoom *room)
Join a room, given a PurpleRoomlistRoom and it&#39;s associated PurpleRoomlist.
purple_roomlist_get_fields
GList * purple_roomlist_get_fields(PurpleRoomlist *roomlist)
Get the list of fields for a roomlist.
purple_roomlist_room_add
void purple_roomlist_room_add(PurpleRoomlist *list, PurpleRoomlistRoom *room)
Adds a room to the list of them.
PurpleRoomlistRoomType
PurpleRoomlistRoomType
The types of rooms.
Definition: roomlist.h:41
_PurpleRoomlist::fields
GList * fields
The fields.
Definition: roomlist.h:71
PURPLE_ROOMLIST_FIELD_STRING
We do a g_strdup on the passed value if it&#39;s this type.
Definition: roomlist.h:55
_PurpleRoomlistUiOps::add_room
void(* add_room)(PurpleRoomlist *list, PurpleRoomlistRoom *room)
Add a room to the list.
Definition: roomlist.h:107
purple_roomlist_expand_category
void purple_roomlist_expand_category(PurpleRoomlist *list, PurpleRoomlistRoom *category)
Tells the prpl that a category was expanded.
_PurpleRoomlistUiOps::create
void(* create)(PurpleRoomlist *list)
A new list was created.
Definition: roomlist.h:105
_PurpleRoomlistRoom::expanded_once
gboolean expanded_once
A flag the UI uses to avoid multiple expand prpl cbs.
Definition: roomlist.h:87
purple_roomlist_field_new
PurpleRoomlistField * purple_roomlist_field_new(PurpleRoomlistFieldType type, const gchar *label, const gchar *name, gboolean hidden)
Creates a new field.
purple_roomlist_field_get_hidden
gboolean purple_roomlist_field_get_hidden(PurpleRoomlistField *field)
Check whether a roomlist-field is hidden.
purple_roomlist_ref
void purple_roomlist_ref(PurpleRoomlist *list)
Increases the reference count on the room list.
_PurpleRoomlistUiOps::destroy
void(* destroy)(PurpleRoomlist *list)
We&#39;re destroying list.
Definition: roomlist.h:109
_PurpleAccount
Structure representing an account.
Definition: account.h:169
purple_roomlist_set_ui_ops
void purple_roomlist_set_ui_ops(PurpleRoomlistUiOps *ops)
Sets the UI operations structure to be used in all purple room lists.
purple_roomlist_room_new
PurpleRoomlistRoom * purple_roomlist_room_new(PurpleRoomlistRoomType type, const gchar *name, PurpleRoomlistRoom *parent)
Creates a new room, to be added to the list.
_PurpleRoomlistField::type
PurpleRoomlistFieldType type
The type of field.
Definition: roomlist.h:94
purple_roomlist_room_add_field
void purple_roomlist_room_add_field(PurpleRoomlist *list, PurpleRoomlistRoom *room, gconstpointer field)
Adds a field to a room.
purple_roomlist_set_fields
void purple_roomlist_set_fields(PurpleRoomlist *list, GList *fields)
Set the different field types and their names for this protocol.
purple_roomlist_room_get_fields
GList * purple_roomlist_room_get_fields(PurpleRoomlistRoom *room)
Get the list of fields for a room.
PURPLE_ROOMLIST_ROOMTYPE_CATEGORY
It&#39;s a category, but not a room you can join.
Definition: roomlist.h:43
_PurpleRoomlistField::label
gchar * label
The i18n user displayed name of the field.
Definition: roomlist.h:95
_PurpleRoomlistRoom::parent
PurpleRoomlistRoom * parent
The parent room, or NULL.
Definition: roomlist.h:86
_PurpleRoomlistField
A field a room might have.
Definition: roomlist.h:93
_PurpleRoomlist::account
PurpleAccount * account
The account this list belongs to.
Definition: roomlist.h:70
purple_roomlist_new
PurpleRoomlist * purple_roomlist_new(PurpleAccount *account)
Returns a newly created room list object.
purple_roomlist_unref
void purple_roomlist_unref(PurpleRoomlist *list)
Decreases the reference count on the room list.
_PurpleRoomlist::in_progress
gboolean in_progress
The listing is in progress.
Definition: roomlist.h:73
_PurpleRoomlistUiOps::set_fields
void(* set_fields)(PurpleRoomlist *list, GList *fields)
Sets the columns.
Definition: roomlist.h:106
purple_roomlist_cancel_get_list
void purple_roomlist_cancel_get_list(PurpleRoomlist *list)
Tells the prpl to stop fetching the list.
account.h
Account API.
_PurpleRoomlistUiOps
The room list ops to be filled out by the UI.
Definition: roomlist.h:103
purple_roomlist_room_get_parent
PurpleRoomlistRoom * purple_roomlist_room_get_parent(PurpleRoomlistRoom *room)
Get the parent of a room.
_PurpleRoomlistField::hidden
gboolean hidden
Hidden?
Definition: roomlist.h:97
purple_roomlist_get_in_progress
gboolean purple_roomlist_get_in_progress(PurpleRoomlist *list)
Gets the "in progress" state of the room list.
purple_roomlist_room_get_type
PurpleRoomlistRoomType purple_roomlist_room_get_type(PurpleRoomlistRoom *room)
Get the type of a room.
_PurpleRoomlistRoom::name
gchar * name
The name of the room.
Definition: roomlist.h:84
PURPLE_ROOMLIST_ROOMTYPE_ROOM
It&#39;s a room, like the kind you can join.
Definition: roomlist.h:44
purple_roomlist_get_list
PurpleRoomlist * purple_roomlist_get_list(PurpleConnection *gc)
Returns a PurpleRoomlist structure from the prpl, and instructs the prpl to start fetching the list...
_PurpleRoomlist
Data Structures.
Definition: roomlist.h:69
purple_roomlist_get_ui_ops
PurpleRoomlistUiOps * purple_roomlist_get_ui_ops(void)
Returns the purple window UI operations structure to be used in new windows.
_PurpleConnection
Definition: connection.h:245
purple_roomlist_field_get_type
PurpleRoomlistFieldType purple_roomlist_field_get_type(PurpleRoomlistField *field)
Get the type of a field.
purple_roomlist_field_get_label
const char * purple_roomlist_field_get_label(PurpleRoomlistField *field)
Get the label of a field.
_PurpleRoomlist::ref
guint ref
Prpl private data.
Definition: roomlist.h:76
_PurpleRoomlistRoom::fields
GList * fields
Other fields.
Definition: roomlist.h:85
purple_roomlist_room_get_name
const char * purple_roomlist_room_get_name(PurpleRoomlistRoom *room)
Get the name of a room.
_PurpleRoomlist::rooms
GList * rooms
The list of rooms.
Definition: roomlist.h:72
_PurpleRoomlistUiOps::show_with_account
void(* show_with_account)(PurpleAccount *account)
Force the ui to pop up a dialog and get the list.
Definition: roomlist.h:104
_PurpleRoomlistUiOps::in_progress
void(* in_progress)(PurpleRoomlist *list, gboolean flag)
Are we fetching stuff still?
Definition: roomlist.h:108
_PurpleRoomlistRoom
Represents a room.
Definition: roomlist.h:82
purple_roomlist_set_in_progress
void purple_roomlist_set_in_progress(PurpleRoomlist *list, gboolean in_progress)
Set the "in progress" state of the room list.
_PurpleRoomlistField::name
gchar * name
The internal name of the field.
Definition: roomlist.h:96
_PurpleRoomlist::ui_data
gpointer ui_data
UI private data.
Definition: roomlist.h:74
_PurpleRoomlistRoom::type
PurpleRoomlistRoomType type
The type of room.
Definition: roomlist.h:83