Tue, 20 Jan 2004 02:51:14 +0000
[gaim-migrate @ 8854]
"
(16:36:05) Me: Hi Sean
(16:36:21) Me: Mind if I e-mail you a little COPYRIGHT related diff?
(16:37:17) Sean: Yes, I do!
(16:37:22) Sean: How dare you consider e-mailing me patches?
(16:37:26) Sean: seriously, now.
(16:37:32) Me:
(16:38:42) Me: Look at my webcam:
[URL to patch, now attached to this message]
(16:43:03) Sean: Have Luke commit it for me
(16:43:17) Sean: I won't be around until late tomorrow night.
(16:46:53) Me: ahh, k
It's a pretty straightforward deal - I think I mentioned this the other
day: .[c|h] files in src/ should have the generic copyright. Also,
giving Marc Mulcahy credit for the accessibility stuff.
Cheers,
John [Silvestri]"
except that i'd already given Marc credit
committer: Luke Schierer <lschiere@pidgin.im>
| 8113 | 1 | /** |
| 2 | * @file roomlist.h Room List API | |
| 3 | * @ingroup core | |
| 4 | * | |
| 5 | * gaim | |
| 6 | * | |
|
8146
4961c9c5fd61
[gaim-migrate @ 8854]
John Silvestri <john.silvestri@gmail.com>
parents:
8113
diff
changeset
|
7 | * Gaim is the legal property of its developers, whose names are too numerous |
|
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 | ||
| 26 | #ifndef _GAIM_ROOMLIST_H_ | |
| 27 | #define _GAIM_ROOMLIST_H_ | |
| 28 | ||
| 29 | /**************************************************************************/ | |
| 30 | /** Data Structures */ | |
| 31 | /**************************************************************************/ | |
| 32 | ||
| 33 | typedef struct _GaimRoomlist GaimRoomlist; | |
| 34 | typedef struct _GaimRoomlistRoom GaimRoomlistRoom; | |
| 35 | typedef enum _GaimRoomlistRoomType GaimRoomlistRoomType; | |
| 36 | typedef struct _GaimRoomlistField GaimRoomlistField; | |
| 37 | typedef enum _GaimRoomlistFieldType GaimRoomlistFieldType; | |
| 38 | typedef struct _GaimRoomlistUiOps GaimRoomlistUiOps; | |
| 39 | ||
| 40 | /** | |
| 41 | * Represents a list of rooms for a given connection on a given protocol. | |
| 42 | */ | |
| 43 | struct _GaimRoomlist { | |
| 44 | GaimAccount *account; /**< The account this list belongs to. */ | |
| 45 | GList *fields; /**< The fields. */ | |
| 46 | GList *rooms; /**< The list of rooms. */ | |
| 47 | gpointer ui_data; /**< UI private data. */ | |
| 48 | gpointer proto_data; /** Prpl private data. */ | |
| 49 | guint ref; /**< The reference count. */ | |
| 50 | }; | |
| 51 | ||
| 52 | /** | |
| 53 | * The types of rooms. | |
| 54 | * | |
| 55 | * These are ORable flags. | |
| 56 | */ | |
| 57 | enum _GaimRoomlistRoomType { | |
| 58 | GAIM_ROOMLIST_ROOMTYPE_CATAGORY = 0x01, /**< It's a catagory, but not a room you can join. */ | |
| 59 | GAIM_ROOMLIST_ROOMTYPE_ROOM = 0x02, /**< It's a room, like the kind you can join. */ | |
| 60 | }; | |
| 61 | ||
| 62 | /** | |
| 63 | * Represents a room. | |
| 64 | */ | |
| 65 | struct _GaimRoomlistRoom { | |
| 66 | GaimRoomlistRoomType type; /**< The type of room. */ | |
| 67 | gchar *name; /**< The name of the room. */ | |
| 68 | GList *fields; /**< Other fields. */ | |
| 69 | GaimRoomlistRoom *parent; /**< The parent room, or NULL. */ | |
| 70 | gboolean expanded_once; /**< A flag the UI uses to avoid multiple expand prpl cbs. */ | |
| 71 | }; | |
| 72 | ||
| 73 | /** | |
| 74 | * The types of fields. | |
| 75 | */ | |
| 76 | enum _GaimRoomlistFieldType { | |
| 77 | GAIM_ROOMLIST_FIELD_BOOL, | |
| 78 | GAIM_ROOMLIST_FIELD_INT, | |
| 79 | GAIM_ROOMLIST_FIELD_STRING, /**< We do a g_strdup on the passed value if it's this type. */ | |
| 80 | }; | |
| 81 | ||
| 82 | /** | |
| 83 | * A field a room might have. | |
| 84 | */ | |
| 85 | struct _GaimRoomlistField { | |
| 86 | GaimRoomlistFieldType type; /**< The type of field. */ | |
| 87 | gchar *label; /**< The i18n user displayed name of the field. */ | |
| 88 | gchar *name; /**< The internal name of the field. */ | |
| 89 | gboolean hidden; /**< Hidden? */ | |
| 90 | }; | |
| 91 | ||
| 92 | /** | |
| 93 | * The room list ops to be filled out by the UI. | |
| 94 | */ | |
| 95 | struct _GaimRoomlistUiOps { | |
| 96 | void (*new)(GaimRoomlist *list); /**< A new list was created. */ | |
| 97 | void (*set_fields)(GaimRoomlist *list, GList *fields); /**< Sets the columns. */ | |
| 98 | void (*add_room)(GaimRoomlist *list, GaimRoomlistRoom *room); /**< Add a room to the list. */ | |
| 99 | void (*in_progress)(GaimRoomlist *list, gboolean flag); /**< Are we fetching stuff still? */ | |
| 100 | void (*destroy)(GaimRoomlist *list); /**< We're destroying list. */ | |
| 101 | }; | |
| 102 | ||
| 103 | ||
| 104 | #ifdef __cplusplus | |
| 105 | extern "C" { | |
| 106 | #endif | |
| 107 | ||
| 108 | /**************************************************************************/ | |
| 109 | /** @name Room List API */ | |
| 110 | /**************************************************************************/ | |
| 111 | /*@{*/ | |
| 112 | ||
| 113 | /** | |
| 114 | * Returns a newly created room list object. | |
| 115 | * | |
| 116 | * It has an inital reference count of 1. | |
| 117 | * | |
| 118 | * @param account The account that's listing rooms. | |
| 119 | * @return The new room list handle. | |
| 120 | */ | |
| 121 | GaimRoomlist *gaim_roomlist_new(GaimAccount *account); | |
| 122 | ||
| 123 | /** | |
| 124 | * Increases the reference count on the room list. | |
| 125 | * | |
| 126 | * @param list The object to ref. | |
| 127 | */ | |
| 128 | void gaim_roomlist_ref(GaimRoomlist *list); | |
| 129 | ||
| 130 | /** | |
| 131 | * Decreases the reference count on the room list. | |
| 132 | * | |
| 133 | * The room list will be destroyed when this reaches 0. | |
| 134 | * | |
| 135 | * @param list The room list object to unref and possibly | |
| 136 | * destroy. | |
| 137 | */ | |
| 138 | void gaim_roomlist_unref(GaimRoomlist *list); | |
| 139 | ||
| 140 | /** | |
| 141 | * Set the different field types and their names for this protocol. | |
| 142 | * | |
| 143 | * This must be called before gaim_roomlist_room_add(). | |
| 144 | * | |
| 145 | * @param list The room list. | |
| 146 | * @param fields A GList of GaimRoomlistField's. UI's are encourged | |
| 147 | * to default to displaying them in the order given. | |
| 148 | */ | |
| 149 | void gaim_roomlist_set_fields(GaimRoomlist *list, GList *fields); | |
| 150 | ||
| 151 | /** | |
| 152 | * Set the "in progress" state of the room list. | |
| 153 | * | |
| 154 | * The UI is encourged to somehow hint to the user | |
| 155 | * whether or not we're busy downloading a room list or not. | |
| 156 | * | |
| 157 | * @param list The room list. | |
| 158 | * @param in_progress We're downloading it, or we're not. | |
| 159 | */ | |
| 160 | void gaim_roomlist_set_in_progress(GaimRoomlist *list, gboolean in_progress); | |
| 161 | ||
| 162 | /** | |
| 163 | * Adds a room to the list of them. | |
| 164 | * | |
| 165 | * @param list The room list. | |
| 166 | * @param room The room to add to the list. The GList of fields must be in the same | |
| 167 | order as was given in gaim_roomlist_set_fields(). | |
| 168 | */ | |
| 169 | void gaim_roomlist_room_add(GaimRoomlist *list, GaimRoomlistRoom *room); | |
| 170 | ||
| 171 | /** | |
| 172 | * Do we support room listing? | |
| 173 | * | |
| 174 | * @param gc The GaimConnection we're asking. | |
| 175 | * @return @c TRUE if it's possible to get a room list. | |
| 176 | */ | |
| 177 | gboolean gaim_roomlist_is_possible(GaimConnection *gc); | |
| 178 | ||
| 179 | /** | |
| 180 | * Returns a GaimRoomlist structure from the prpl, and | |
| 181 | * instructs the prpl to start fetching the list. | |
| 182 | * | |
| 183 | * @param gc The GaimConnection to have get a list. | |
| 184 | * | |
| 185 | * @return A GaimRoomlist* or @c NULL if the protocol | |
| 186 | * doesn't support that. | |
| 187 | */ | |
| 188 | GaimRoomlist *gaim_roomlist_get_list(GaimConnection *gc); | |
| 189 | ||
| 190 | /** | |
| 191 | * Tells the prpl to stop fetching the list. | |
| 192 | * If this is possible and done, the prpl will | |
| 193 | * call set_in_progress with @c FALSE and possibly | |
| 194 | * unref the list if it took a reference. | |
| 195 | * | |
| 196 | * @param list The room list to cancel a get_list on. | |
| 197 | */ | |
| 198 | void gaim_roomlist_cancel_get_list(GaimRoomlist *list); | |
| 199 | ||
| 200 | /** | |
| 201 | * Tells the prpl that a catagory was expanded. | |
| 202 | * | |
| 203 | * On some protocols, the rooms in the catagory | |
| 204 | * won't be fetched until this is called. | |
| 205 | * | |
| 206 | * @param list The room list. | |
| 207 | * @param room The catagory that was expanded. The expression | |
| 208 | * (catagory->type & GAIM_ROOMLIST_ROOMTYPE_CATAGORY) | |
| 209 | * must be true. | |
| 210 | */ | |
| 211 | void gaim_roomlist_expand_catagory(GaimRoomlist *list, GaimRoomlistRoom *catagory); | |
| 212 | ||
| 213 | /*@}*/ | |
| 214 | ||
| 215 | /**************************************************************************/ | |
| 216 | /** @name Room API */ | |
| 217 | /**************************************************************************/ | |
| 218 | /*@{*/ | |
| 219 | ||
| 220 | /** | |
| 221 | * Creates a new room, to be added to the list. | |
| 222 | * | |
| 223 | * @param type The type of room. | |
| 224 | * @param name The name of the room. | |
| 225 | * @param parent The room's parent, if any. | |
| 226 | * | |
| 227 | * @return A new room. | |
| 228 | */ | |
| 229 | GaimRoomlistRoom *gaim_roomlist_room_new(GaimRoomlistRoomType type, const gchar *name, | |
| 230 | GaimRoomlistRoom *parent); | |
| 231 | ||
| 232 | /** | |
| 233 | * Adds a field to a room. | |
| 234 | * | |
| 235 | * @param list The room list the room belongs to. | |
| 236 | * @param room The room. | |
| 237 | * @param field The field to append. Strings get g_strdup'd internally. | |
| 238 | */ | |
| 239 | void gaim_roomlist_room_add_field(GaimRoomlist *list, GaimRoomlistRoom *room, gconstpointer field); | |
| 240 | ||
| 241 | /*@}*/ | |
| 242 | ||
| 243 | /**************************************************************************/ | |
| 244 | /** @name Room Field API */ | |
| 245 | /**************************************************************************/ | |
| 246 | /*@{*/ | |
| 247 | ||
| 248 | /** | |
| 249 | * Creates a new field. | |
| 250 | * | |
| 251 | * @param type The type of the field. | |
| 252 | * @param label The i18n'ed, user displayable name. | |
| 253 | * @param name The internal name of the field. | |
| 254 | * | |
| 255 | * @return A new GaimRoomlistField, ready to be added to a GList and passed to | |
| 256 | * gaim_roomlist_set_fields(). | |
| 257 | */ | |
| 258 | GaimRoomlistField *gaim_roomlist_field_new(GaimRoomlistFieldType type, | |
| 259 | const gchar *label, const gchar *name, | |
| 260 | gboolean hidden); | |
| 261 | /*@}*/ | |
| 262 | ||
| 263 | /**************************************************************************/ | |
| 264 | /** @name UI Registration Functions */ | |
| 265 | /**************************************************************************/ | |
| 266 | /*@{*/ | |
| 267 | ||
| 268 | /** | |
| 269 | * Sets the UI operations structure to be used in all gaim room lists. | |
| 270 | * | |
| 271 | * @param ops The UI operations structure. | |
| 272 | */ | |
| 273 | void gaim_roomlist_set_ui_ops(GaimRoomlistUiOps *ops); | |
| 274 | ||
| 275 | /** | |
| 276 | * Returns the gaim window UI operations structure to be used in | |
| 277 | * new windows. | |
| 278 | * | |
| 279 | * @return A filled-out GaimRoomlistUiOps structure. | |
| 280 | */ | |
| 281 | GaimRoomlistUiOps *gaim_roomlist_get_ui_ops(void); | |
| 282 | ||
| 283 | /*@}*/ | |
| 284 | ||
| 285 | #ifdef __cplusplus | |
| 286 | } | |
| 287 | #endif | |
| 288 | ||
| 289 | #endif /* _GAIM_ROOMLIST_H_ */ |