Thu, 14 Jun 2007 07:00:47 +0000
Improve the formatting of some gstreamer error messages. Someone
with the finch soc branch checked out should make these changes
there, too
| 8113 | 1 | /** |
| 2 | * @file roomlist.h Room List API | |
| 3 | * @ingroup core | |
| 4 | * | |
| 15884 | 5 | * purple |
| 8113 | 6 | * |
| 15884 | 7 | * Purple is the legal property of its developers, whose names are too numerous |
|
8146
4961c9c5fd61
[gaim-migrate @ 8854]
John Silvestri <john.silvestri@gmail.com>
parents:
8113
diff
changeset
|
8 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
4961c9c5fd61
[gaim-migrate @ 8854]
John Silvestri <john.silvestri@gmail.com>
parents:
8113
diff
changeset
|
9 | * source distribution. |
| 8113 | 10 | * |
| 11 | * This program is free software; you can redistribute it and/or modify | |
| 12 | * it under the terms of the GNU General Public License as published by | |
| 13 | * the Free Software Foundation; either version 2 of the License, or | |
| 14 | * (at your option) any later version. | |
| 15 | * | |
| 16 | * This program is distributed in the hope that it will be useful, | |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 19 | * GNU General Public License for more details. | |
| 20 | * | |
| 21 | * You should have received a copy of the GNU General Public License | |
| 22 | * along with this program; if not, write to the Free Software | |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 24 | */ | |
| 25 | ||
| 15884 | 26 | #ifndef _PURPLE_ROOMLIST_H_ |
| 27 | #define _PURPLE_ROOMLIST_H_ | |
| 8113 | 28 | |
| 15884 | 29 | typedef struct _PurpleRoomlist PurpleRoomlist; |
| 30 | typedef struct _PurpleRoomlistRoom PurpleRoomlistRoom; | |
| 31 | typedef struct _PurpleRoomlistField PurpleRoomlistField; | |
| 32 | typedef struct _PurpleRoomlistUiOps PurpleRoomlistUiOps; | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9000
diff
changeset
|
33 | |
|
9999
86e89e1dee10
[gaim-migrate @ 10913]
Mark Doliner <markdoliner@pidgin.im>
parents:
9030
diff
changeset
|
34 | /** |
|
86e89e1dee10
[gaim-migrate @ 10913]
Mark Doliner <markdoliner@pidgin.im>
parents:
9030
diff
changeset
|
35 | * The types of rooms. |
|
86e89e1dee10
[gaim-migrate @ 10913]
Mark Doliner <markdoliner@pidgin.im>
parents:
9030
diff
changeset
|
36 | * |
|
86e89e1dee10
[gaim-migrate @ 10913]
Mark Doliner <markdoliner@pidgin.im>
parents:
9030
diff
changeset
|
37 | * These are ORable flags. |
|
86e89e1dee10
[gaim-migrate @ 10913]
Mark Doliner <markdoliner@pidgin.im>
parents:
9030
diff
changeset
|
38 | */ |
|
86e89e1dee10
[gaim-migrate @ 10913]
Mark Doliner <markdoliner@pidgin.im>
parents:
9030
diff
changeset
|
39 | typedef enum |
|
86e89e1dee10
[gaim-migrate @ 10913]
Mark Doliner <markdoliner@pidgin.im>
parents:
9030
diff
changeset
|
40 | { |
| 15884 | 41 | PURPLE_ROOMLIST_ROOMTYPE_CATEGORY = 0x01, /**< It's a category, but not a room you can join. */ |
| 42 | PURPLE_ROOMLIST_ROOMTYPE_ROOM = 0x02 /**< It's a room, like the kind you can join. */ | |
|
9999
86e89e1dee10
[gaim-migrate @ 10913]
Mark Doliner <markdoliner@pidgin.im>
parents:
9030
diff
changeset
|
43 | |
| 15884 | 44 | } PurpleRoomlistRoomType; |
|
9999
86e89e1dee10
[gaim-migrate @ 10913]
Mark Doliner <markdoliner@pidgin.im>
parents:
9030
diff
changeset
|
45 | |
|
86e89e1dee10
[gaim-migrate @ 10913]
Mark Doliner <markdoliner@pidgin.im>
parents:
9030
diff
changeset
|
46 | /** |
|
86e89e1dee10
[gaim-migrate @ 10913]
Mark Doliner <markdoliner@pidgin.im>
parents:
9030
diff
changeset
|
47 | * The types of fields. |
|
86e89e1dee10
[gaim-migrate @ 10913]
Mark Doliner <markdoliner@pidgin.im>
parents:
9030
diff
changeset
|
48 | */ |
|
86e89e1dee10
[gaim-migrate @ 10913]
Mark Doliner <markdoliner@pidgin.im>
parents:
9030
diff
changeset
|
49 | typedef enum |
|
86e89e1dee10
[gaim-migrate @ 10913]
Mark Doliner <markdoliner@pidgin.im>
parents:
9030
diff
changeset
|
50 | { |
| 15884 | 51 | PURPLE_ROOMLIST_FIELD_BOOL, |
| 52 | PURPLE_ROOMLIST_FIELD_INT, | |
| 53 | PURPLE_ROOMLIST_FIELD_STRING /**< We do a g_strdup on the passed value if it's this type. */ | |
|
9999
86e89e1dee10
[gaim-migrate @ 10913]
Mark Doliner <markdoliner@pidgin.im>
parents:
9030
diff
changeset
|
54 | |
| 15884 | 55 | } PurpleRoomlistFieldType; |
|
9999
86e89e1dee10
[gaim-migrate @ 10913]
Mark Doliner <markdoliner@pidgin.im>
parents:
9030
diff
changeset
|
56 | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9000
diff
changeset
|
57 | #include "account.h" |
|
10023
6b0014040323
[gaim-migrate @ 10955]
Mark Doliner <markdoliner@pidgin.im>
parents:
9999
diff
changeset
|
58 | #include "glib.h" |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9000
diff
changeset
|
59 | |
| 8113 | 60 | /**************************************************************************/ |
| 61 | /** Data Structures */ | |
| 62 | /**************************************************************************/ | |
| 63 | ||
| 64 | /** | |
| 65 | * Represents a list of rooms for a given connection on a given protocol. | |
| 66 | */ | |
| 15884 | 67 | struct _PurpleRoomlist { |
| 68 | PurpleAccount *account; /**< The account this list belongs to. */ | |
| 8113 | 69 | GList *fields; /**< The fields. */ |
| 70 | GList *rooms; /**< The list of rooms. */ | |
| 8199 | 71 | gboolean in_progress; /**< The listing is in progress. */ |
| 8113 | 72 | gpointer ui_data; /**< UI private data. */ |
| 73 | gpointer proto_data; /** Prpl private data. */ | |
| 74 | guint ref; /**< The reference count. */ | |
| 75 | }; | |
| 76 | ||
| 77 | /** | |
| 78 | * Represents a room. | |
| 79 | */ | |
| 15884 | 80 | struct _PurpleRoomlistRoom { |
| 81 | PurpleRoomlistRoomType type; /**< The type of room. */ | |
| 8113 | 82 | gchar *name; /**< The name of the room. */ |
| 83 | GList *fields; /**< Other fields. */ | |
| 15884 | 84 | PurpleRoomlistRoom *parent; /**< The parent room, or NULL. */ |
| 8113 | 85 | gboolean expanded_once; /**< A flag the UI uses to avoid multiple expand prpl cbs. */ |
| 86 | }; | |
| 87 | ||
| 88 | /** | |
| 89 | * A field a room might have. | |
| 90 | */ | |
| 15884 | 91 | struct _PurpleRoomlistField { |
| 92 | PurpleRoomlistFieldType type; /**< The type of field. */ | |
| 8113 | 93 | gchar *label; /**< The i18n user displayed name of the field. */ |
| 94 | gchar *name; /**< The internal name of the field. */ | |
| 95 | gboolean hidden; /**< Hidden? */ | |
| 96 | }; | |
| 97 | ||
| 98 | /** | |
| 99 | * The room list ops to be filled out by the UI. | |
| 100 | */ | |
| 15884 | 101 | struct _PurpleRoomlistUiOps { |
| 102 | void (*show_with_account)(PurpleAccount *account); /**< Force the ui to pop up a dialog and get the list */ | |
| 103 | void (*create)(PurpleRoomlist *list); /**< A new list was created. */ | |
| 104 | void (*set_fields)(PurpleRoomlist *list, GList *fields); /**< Sets the columns. */ | |
| 105 | void (*add_room)(PurpleRoomlist *list, PurpleRoomlistRoom *room); /**< Add a room to the list. */ | |
| 106 | void (*in_progress)(PurpleRoomlist *list, gboolean flag); /**< Are we fetching stuff still? */ | |
| 107 | void (*destroy)(PurpleRoomlist *list); /**< We're destroying list. */ | |
|
16743
1ce5ffe12e2a
Initial addition of padding for ui_ops and other class-like structs
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
108 | |
|
1ce5ffe12e2a
Initial addition of padding for ui_ops and other class-like structs
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
109 | void (*_purple_reserved1)(void); |
|
1ce5ffe12e2a
Initial addition of padding for ui_ops and other class-like structs
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
110 | void (*_purple_reserved2)(void); |
|
1ce5ffe12e2a
Initial addition of padding for ui_ops and other class-like structs
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
111 | void (*_purple_reserved3)(void); |
|
1ce5ffe12e2a
Initial addition of padding for ui_ops and other class-like structs
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
112 | void (*_purple_reserved4)(void); |
| 8113 | 113 | }; |
| 114 | ||
| 115 | ||
| 116 | #ifdef __cplusplus | |
| 117 | extern "C" { | |
| 118 | #endif | |
| 119 | ||
| 120 | /**************************************************************************/ | |
| 121 | /** @name Room List API */ | |
| 122 | /**************************************************************************/ | |
| 123 | /*@{*/ | |
| 124 | ||
| 125 | /** | |
| 8352 | 126 | * This is used to get the room list on an account, asking the UI |
| 127 | * to pop up a dialog with the specified account already selected, | |
| 128 | * and pretend the user clicked the get list button. | |
| 129 | * While we're pretending, predend I didn't say anything about dialogs | |
| 130 | * or buttons, since this is the core. | |
| 131 | * | |
| 132 | * @param account The account to get the list on. | |
| 133 | */ | |
| 15884 | 134 | void purple_roomlist_show_with_account(PurpleAccount *account); |
| 8352 | 135 | |
| 136 | /** | |
| 8113 | 137 | * Returns a newly created room list object. |
| 138 | * | |
|
8735
01248ea222d3
[gaim-migrate @ 9490]
Jonathan Champ <royanee@users.sourceforge.net>
parents:
8584
diff
changeset
|
139 | * It has an initial reference count of 1. |
| 8113 | 140 | * |
| 141 | * @param account The account that's listing rooms. | |
| 142 | * @return The new room list handle. | |
| 143 | */ | |
| 15884 | 144 | PurpleRoomlist *purple_roomlist_new(PurpleAccount *account); |
| 8113 | 145 | |
| 146 | /** | |
| 147 | * Increases the reference count on the room list. | |
| 148 | * | |
| 149 | * @param list The object to ref. | |
| 150 | */ | |
| 15884 | 151 | void purple_roomlist_ref(PurpleRoomlist *list); |
| 8113 | 152 | |
| 153 | /** | |
| 154 | * Decreases the reference count on the room list. | |
| 155 | * | |
| 156 | * The room list will be destroyed when this reaches 0. | |
| 157 | * | |
| 158 | * @param list The room list object to unref and possibly | |
| 159 | * destroy. | |
| 160 | */ | |
| 15884 | 161 | void purple_roomlist_unref(PurpleRoomlist *list); |
| 8113 | 162 | |
| 163 | /** | |
| 164 | * Set the different field types and their names for this protocol. | |
| 165 | * | |
| 15884 | 166 | * This must be called before purple_roomlist_room_add(). |
| 8113 | 167 | * |
| 168 | * @param list The room list. | |
| 15884 | 169 | * @param fields A GList of PurpleRoomlistField's. UI's are encouraged |
| 8113 | 170 | * to default to displaying them in the order given. |
| 171 | */ | |
| 15884 | 172 | void purple_roomlist_set_fields(PurpleRoomlist *list, GList *fields); |
| 8113 | 173 | |
| 174 | /** | |
| 175 | * Set the "in progress" state of the room list. | |
| 176 | * | |
|
8735
01248ea222d3
[gaim-migrate @ 9490]
Jonathan Champ <royanee@users.sourceforge.net>
parents:
8584
diff
changeset
|
177 | * The UI is encouraged to somehow hint to the user |
| 8113 | 178 | * whether or not we're busy downloading a room list or not. |
| 179 | * | |
| 180 | * @param list The room list. | |
| 181 | * @param in_progress We're downloading it, or we're not. | |
| 182 | */ | |
| 15884 | 183 | void purple_roomlist_set_in_progress(PurpleRoomlist *list, gboolean in_progress); |
| 8113 | 184 | |
| 185 | /** | |
| 8199 | 186 | * Gets the "in progress" state of the room list. |
| 187 | * | |
|
8735
01248ea222d3
[gaim-migrate @ 9490]
Jonathan Champ <royanee@users.sourceforge.net>
parents:
8584
diff
changeset
|
188 | * The UI is encouraged to somehow hint to the user |
| 8199 | 189 | * whether or not we're busy downloading a room list or not. |
| 190 | * | |
| 191 | * @param list The room list. | |
| 8866 | 192 | * @return True if we're downloading it, or false if we're not. |
| 8199 | 193 | */ |
| 15884 | 194 | gboolean purple_roomlist_get_in_progress(PurpleRoomlist *list); |
| 8199 | 195 | |
| 196 | /** | |
| 8113 | 197 | * Adds a room to the list of them. |
| 198 | * | |
| 199 | * @param list The room list. | |
| 200 | * @param room The room to add to the list. The GList of fields must be in the same | |
| 15884 | 201 | order as was given in purple_roomlist_set_fields(). |
| 8113 | 202 | */ |
| 15884 | 203 | void purple_roomlist_room_add(PurpleRoomlist *list, PurpleRoomlistRoom *room); |
| 8113 | 204 | |
| 205 | /** | |
| 15884 | 206 | * Returns a PurpleRoomlist structure from the prpl, and |
| 8113 | 207 | * instructs the prpl to start fetching the list. |
| 208 | * | |
| 15884 | 209 | * @param gc The PurpleConnection to have get a list. |
| 8113 | 210 | * |
| 15884 | 211 | * @return A PurpleRoomlist* or @c NULL if the protocol |
| 8113 | 212 | * doesn't support that. |
| 213 | */ | |
| 15884 | 214 | PurpleRoomlist *purple_roomlist_get_list(PurpleConnection *gc); |
| 8113 | 215 | |
| 216 | /** | |
| 217 | * Tells the prpl to stop fetching the list. | |
| 218 | * If this is possible and done, the prpl will | |
| 219 | * call set_in_progress with @c FALSE and possibly | |
| 220 | * unref the list if it took a reference. | |
| 221 | * | |
| 222 | * @param list The room list to cancel a get_list on. | |
| 223 | */ | |
| 15884 | 224 | void purple_roomlist_cancel_get_list(PurpleRoomlist *list); |
| 8113 | 225 | |
| 226 | /** | |
| 8584 | 227 | * Tells the prpl that a category was expanded. |
| 8113 | 228 | * |
| 8584 | 229 | * On some protocols, the rooms in the category |
| 8113 | 230 | * won't be fetched until this is called. |
| 231 | * | |
| 9000 | 232 | * @param list The room list. |
| 233 | * @param category The category that was expanded. The expression | |
| 15884 | 234 | * (category->type & PURPLE_ROOMLIST_ROOMTYPE_CATEGORY) |
| 9000 | 235 | * must be true. |
| 8113 | 236 | */ |
| 15884 | 237 | void purple_roomlist_expand_category(PurpleRoomlist *list, PurpleRoomlistRoom *category); |
| 8113 | 238 | |
| 239 | /*@}*/ | |
| 240 | ||
| 241 | /**************************************************************************/ | |
| 242 | /** @name Room API */ | |
| 243 | /**************************************************************************/ | |
| 244 | /*@{*/ | |
| 245 | ||
| 246 | /** | |
| 247 | * Creates a new room, to be added to the list. | |
| 248 | * | |
| 249 | * @param type The type of room. | |
| 250 | * @param name The name of the room. | |
| 251 | * @param parent The room's parent, if any. | |
| 252 | * | |
| 253 | * @return A new room. | |
| 254 | */ | |
| 15884 | 255 | PurpleRoomlistRoom *purple_roomlist_room_new(PurpleRoomlistRoomType type, const gchar *name, |
| 256 | PurpleRoomlistRoom *parent); | |
| 8113 | 257 | |
| 258 | /** | |
| 259 | * Adds a field to a room. | |
| 260 | * | |
| 261 | * @param list The room list the room belongs to. | |
| 262 | * @param room The room. | |
| 263 | * @param field The field to append. Strings get g_strdup'd internally. | |
| 264 | */ | |
| 15884 | 265 | void purple_roomlist_room_add_field(PurpleRoomlist *list, PurpleRoomlistRoom *room, gconstpointer field); |
| 8113 | 266 | |
| 8199 | 267 | /** |
| 15884 | 268 | * Join a room, given a PurpleRoomlistRoom and it's associated PurpleRoomlist. |
| 8199 | 269 | * |
| 270 | * @param list The room list the room belongs to. | |
| 271 | * @param room The room to join. | |
| 272 | */ | |
| 15884 | 273 | void purple_roomlist_room_join(PurpleRoomlist *list, PurpleRoomlistRoom *room); |
| 8199 | 274 | |
| 8113 | 275 | /*@}*/ |
| 276 | ||
| 277 | /**************************************************************************/ | |
| 278 | /** @name Room Field API */ | |
| 279 | /**************************************************************************/ | |
| 280 | /*@{*/ | |
| 281 | ||
| 282 | /** | |
| 283 | * Creates a new field. | |
| 284 | * | |
| 9000 | 285 | * @param type The type of the field. |
| 286 | * @param label The i18n'ed, user displayable name. | |
| 287 | * @param name The internal name of the field. | |
| 288 | * @param hidden Hide the field. | |
| 8113 | 289 | * |
| 15884 | 290 | * @return A new PurpleRoomlistField, ready to be added to a GList and passed to |
| 291 | * purple_roomlist_set_fields(). | |
| 8113 | 292 | */ |
| 15884 | 293 | PurpleRoomlistField *purple_roomlist_field_new(PurpleRoomlistFieldType type, |
| 8113 | 294 | const gchar *label, const gchar *name, |
| 295 | gboolean hidden); | |
| 296 | /*@}*/ | |
| 297 | ||
| 298 | /**************************************************************************/ | |
| 299 | /** @name UI Registration Functions */ | |
| 300 | /**************************************************************************/ | |
| 301 | /*@{*/ | |
| 302 | ||
| 303 | /** | |
| 15884 | 304 | * Sets the UI operations structure to be used in all purple room lists. |
| 8113 | 305 | * |
| 306 | * @param ops The UI operations structure. | |
| 307 | */ | |
| 15884 | 308 | void purple_roomlist_set_ui_ops(PurpleRoomlistUiOps *ops); |
| 8113 | 309 | |
| 310 | /** | |
| 15884 | 311 | * Returns the purple window UI operations structure to be used in |
| 8113 | 312 | * new windows. |
| 313 | * | |
| 15884 | 314 | * @return A filled-out PurpleRoomlistUiOps structure. |
| 8113 | 315 | */ |
| 15884 | 316 | PurpleRoomlistUiOps *purple_roomlist_get_ui_ops(void); |
| 8113 | 317 | |
| 318 | /*@}*/ | |
| 319 | ||
| 320 | #ifdef __cplusplus | |
| 321 | } | |
| 322 | #endif | |
| 323 | ||
| 15884 | 324 | #endif /* _PURPLE_ROOMLIST_H_ */ |