Sat, 22 Mar 2008 09:40:38 +0000
Add log-handlers for farsight foo.
| 8113 | 1 | /** |
| 2 | * @file roomlist.c Room List API | |
| 3 | * @ingroup core | |
|
20147
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
4 | */ |
|
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
5 | |
|
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
6 | /* purple |
| 8113 | 7 | * |
| 15884 | 8 | * 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
|
9 | * 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
|
10 | * source distribution. |
| 8113 | 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 | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18265
diff
changeset
|
24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 8113 | 25 | */ |
| 26 | ||
| 27 | #include <glib.h> | |
| 28 | ||
|
18265
9f26190d7f46
Move the define in internal.h instead.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15884
diff
changeset
|
29 | #include "internal.h" |
|
9f26190d7f46
Move the define in internal.h instead.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15884
diff
changeset
|
30 | |
| 8113 | 31 | #include "account.h" |
| 32 | #include "connection.h" | |
| 33 | #include "debug.h" | |
| 34 | #include "roomlist.h" | |
| 8199 | 35 | #include "server.h" |
| 8113 | 36 | |
| 37 | ||
| 15884 | 38 | static PurpleRoomlistUiOps *ops = NULL; |
| 8113 | 39 | |
| 40 | /**************************************************************************/ | |
| 41 | /** @name Room List API */ | |
| 42 | /**************************************************************************/ | |
| 43 | /*@{*/ | |
| 44 | ||
| 15884 | 45 | void purple_roomlist_show_with_account(PurpleAccount *account) |
| 8352 | 46 | { |
| 47 | if (ops && ops->show_with_account) | |
| 48 | ops->show_with_account(account); | |
| 49 | } | |
| 50 | ||
| 15884 | 51 | PurpleRoomlist *purple_roomlist_new(PurpleAccount *account) |
| 8113 | 52 | { |
| 15884 | 53 | PurpleRoomlist *list; |
| 8113 | 54 | |
| 55 | g_return_val_if_fail(account != NULL, NULL); | |
| 56 | ||
| 15884 | 57 | list = g_new0(PurpleRoomlist, 1); |
| 8113 | 58 | list->account = account; |
| 59 | list->rooms = NULL; | |
| 60 | list->fields = NULL; | |
| 61 | list->ref = 1; | |
| 62 | ||
| 10027 | 63 | if (ops && ops->create) |
| 64 | ops->create(list); | |
| 8113 | 65 | |
| 66 | return list; | |
| 67 | } | |
| 68 | ||
| 15884 | 69 | void purple_roomlist_ref(PurpleRoomlist *list) |
| 8113 | 70 | { |
| 71 | g_return_if_fail(list != NULL); | |
| 72 | ||
| 73 | list->ref++; | |
| 15884 | 74 | purple_debug_misc("roomlist", "reffing list, ref count now %d\n", list->ref); |
| 8113 | 75 | } |
| 76 | ||
| 15884 | 77 | static void purple_roomlist_room_destroy(PurpleRoomlist *list, PurpleRoomlistRoom *r) |
| 8113 | 78 | { |
| 79 | GList *l, *j; | |
| 80 | ||
| 81 | for (l = list->fields, j = r->fields; l && j; l = l->next, j = j->next) { | |
| 15884 | 82 | PurpleRoomlistField *f = l->data; |
| 83 | if (f->type == PURPLE_ROOMLIST_FIELD_STRING) | |
| 8113 | 84 | g_free(j->data); |
| 85 | } | |
| 86 | ||
| 87 | g_list_free(r->fields); | |
| 88 | g_free(r->name); | |
| 89 | g_free(r); | |
| 90 | } | |
| 91 | ||
| 15884 | 92 | static void purple_roomlist_field_destroy(PurpleRoomlistField *f) |
| 8113 | 93 | { |
| 94 | g_free(f->label); | |
| 95 | g_free(f->name); | |
| 96 | g_free(f); | |
| 97 | } | |
| 98 | ||
| 15884 | 99 | static void purple_roomlist_destroy(PurpleRoomlist *list) |
| 8113 | 100 | { |
| 101 | GList *l; | |
| 102 | ||
| 15884 | 103 | purple_debug_misc("roomlist", "destroying list %p\n", list); |
| 8113 | 104 | |
| 105 | if (ops && ops->destroy) | |
| 106 | ops->destroy(list); | |
| 107 | ||
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
12250
diff
changeset
|
108 | for (l = list->rooms; l; l = l->next) { |
| 15884 | 109 | PurpleRoomlistRoom *r = l->data; |
| 110 | purple_roomlist_room_destroy(list, r); | |
| 8113 | 111 | } |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
12250
diff
changeset
|
112 | g_list_free(list->rooms); |
| 8113 | 113 | |
| 15884 | 114 | g_list_foreach(list->fields, (GFunc)purple_roomlist_field_destroy, NULL); |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
12250
diff
changeset
|
115 | g_list_free(list->fields); |
| 8113 | 116 | |
| 117 | g_free(list); | |
| 118 | } | |
| 119 | ||
| 15884 | 120 | void purple_roomlist_unref(PurpleRoomlist *list) |
| 8113 | 121 | { |
| 122 | g_return_if_fail(list != NULL); | |
|
12250
5b14301dd1ec
[gaim-migrate @ 14552]
Richard Laager <rlaager@pidgin.im>
parents:
10027
diff
changeset
|
123 | g_return_if_fail(list->ref > 0); |
| 8113 | 124 | |
| 125 | list->ref--; | |
| 126 | ||
| 15884 | 127 | purple_debug_misc("roomlist", "unreffing list, ref count now %d\n", list->ref); |
| 8113 | 128 | if (list->ref == 0) |
| 15884 | 129 | purple_roomlist_destroy(list); |
| 8113 | 130 | } |
| 131 | ||
| 15884 | 132 | void purple_roomlist_set_fields(PurpleRoomlist *list, GList *fields) |
| 8113 | 133 | { |
| 134 | g_return_if_fail(list != NULL); | |
| 135 | ||
| 136 | list->fields = fields; | |
| 137 | ||
| 138 | if (ops && ops->set_fields) | |
| 139 | ops->set_fields(list, fields); | |
| 140 | } | |
| 141 | ||
| 15884 | 142 | void purple_roomlist_set_in_progress(PurpleRoomlist *list, gboolean in_progress) |
| 8113 | 143 | { |
| 144 | g_return_if_fail(list != NULL); | |
| 145 | ||
| 8199 | 146 | list->in_progress = in_progress; |
| 147 | ||
| 8113 | 148 | if (ops && ops->in_progress) |
| 149 | ops->in_progress(list, in_progress); | |
| 150 | } | |
| 151 | ||
| 15884 | 152 | gboolean purple_roomlist_get_in_progress(PurpleRoomlist *list) |
| 8199 | 153 | { |
| 154 | g_return_val_if_fail(list != NULL, FALSE); | |
| 155 | ||
| 156 | return list->in_progress; | |
| 157 | } | |
| 158 | ||
| 15884 | 159 | void purple_roomlist_room_add(PurpleRoomlist *list, PurpleRoomlistRoom *room) |
| 8113 | 160 | { |
| 161 | g_return_if_fail(list != NULL); | |
| 162 | g_return_if_fail(room != NULL); | |
| 163 | ||
| 164 | list->rooms = g_list_append(list->rooms, room); | |
| 165 | ||
| 166 | if (ops && ops->add_room) | |
| 167 | ops->add_room(list, room); | |
| 168 | } | |
| 169 | ||
| 15884 | 170 | PurpleRoomlist *purple_roomlist_get_list(PurpleConnection *gc) |
| 8113 | 171 | { |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22134
diff
changeset
|
172 | PurplePlugin *prpl = NULL; |
| 15884 | 173 | PurplePluginProtocolInfo *prpl_info = NULL; |
| 8113 | 174 | |
| 175 | g_return_val_if_fail(gc != NULL, NULL); | |
| 176 | ||
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22134
diff
changeset
|
177 | prpl = purple_connection_get_prpl(gc); |
| 8113 | 178 | |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22134
diff
changeset
|
179 | if(prpl != NULL) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22134
diff
changeset
|
180 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22134
diff
changeset
|
181 | |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22134
diff
changeset
|
182 | if(prpl_info && prpl_info->roomlist_get_list) |
| 8113 | 183 | return prpl_info->roomlist_get_list(gc); |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22134
diff
changeset
|
184 | |
| 8113 | 185 | return NULL; |
| 186 | } | |
| 187 | ||
| 15884 | 188 | void purple_roomlist_cancel_get_list(PurpleRoomlist *list) |
| 8113 | 189 | { |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22134
diff
changeset
|
190 | PurplePlugin *prpl = NULL; |
| 15884 | 191 | PurplePluginProtocolInfo *prpl_info = NULL; |
| 192 | PurpleConnection *gc; | |
| 8113 | 193 | |
| 194 | g_return_if_fail(list != NULL); | |
| 195 | ||
| 15884 | 196 | gc = purple_account_get_connection(list->account); |
| 8113 | 197 | |
| 198 | g_return_if_fail(gc != NULL); | |
| 199 | ||
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22134
diff
changeset
|
200 | if(gc) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22134
diff
changeset
|
201 | prpl = purple_connection_get_prpl(gc); |
| 8113 | 202 | |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22134
diff
changeset
|
203 | if(prpl) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22134
diff
changeset
|
204 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22134
diff
changeset
|
205 | |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22134
diff
changeset
|
206 | if(prpl_info && prpl_info->roomlist_cancel) |
| 8113 | 207 | prpl_info->roomlist_cancel(list); |
| 208 | } | |
| 209 | ||
| 15884 | 210 | void purple_roomlist_expand_category(PurpleRoomlist *list, PurpleRoomlistRoom *category) |
| 8113 | 211 | { |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22134
diff
changeset
|
212 | PurplePlugin *prpl = NULL; |
| 15884 | 213 | PurplePluginProtocolInfo *prpl_info = NULL; |
| 214 | PurpleConnection *gc; | |
| 8113 | 215 | |
| 216 | g_return_if_fail(list != NULL); | |
| 8584 | 217 | g_return_if_fail(category != NULL); |
| 15884 | 218 | g_return_if_fail(category->type & PURPLE_ROOMLIST_ROOMTYPE_CATEGORY); |
| 8113 | 219 | |
| 15884 | 220 | gc = purple_account_get_connection(list->account); |
| 8113 | 221 | g_return_if_fail(gc != NULL); |
| 222 | ||
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22134
diff
changeset
|
223 | if(gc) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22134
diff
changeset
|
224 | prpl = purple_connection_get_prpl(gc); |
| 8113 | 225 | |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22134
diff
changeset
|
226 | if(prpl) |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22134
diff
changeset
|
227 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22134
diff
changeset
|
228 | |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22134
diff
changeset
|
229 | if(prpl_info && prpl_info->roomlist_expand_category) |
| 8584 | 230 | prpl_info->roomlist_expand_category(list, category); |
| 8113 | 231 | } |
| 232 | ||
|
22134
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
233 | GList * purple_roomlist_get_fields(PurpleRoomlist *list) |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
234 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
235 | return list->fields; |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
236 | } |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
237 | |
| 8113 | 238 | /*@}*/ |
| 239 | ||
| 240 | /**************************************************************************/ | |
| 241 | /** @name Room API */ | |
| 242 | /**************************************************************************/ | |
| 243 | /*@{*/ | |
| 244 | ||
| 15884 | 245 | PurpleRoomlistRoom *purple_roomlist_room_new(PurpleRoomlistRoomType type, const gchar *name, |
| 246 | PurpleRoomlistRoom *parent) | |
| 8113 | 247 | { |
| 15884 | 248 | PurpleRoomlistRoom *room; |
| 8113 | 249 | |
| 250 | g_return_val_if_fail(name != NULL, NULL); | |
| 251 | ||
| 15884 | 252 | room = g_new0(PurpleRoomlistRoom, 1); |
| 8113 | 253 | room->type = type; |
| 254 | room->name = g_strdup(name); | |
| 255 | room->parent = parent; | |
| 256 | ||
| 257 | return room; | |
| 258 | } | |
| 259 | ||
| 15884 | 260 | void purple_roomlist_room_add_field(PurpleRoomlist *list, PurpleRoomlistRoom *room, gconstpointer field) |
| 8113 | 261 | { |
| 15884 | 262 | PurpleRoomlistField *f; |
| 8113 | 263 | |
| 264 | g_return_if_fail(list != NULL); | |
| 265 | g_return_if_fail(room != NULL); | |
| 266 | g_return_if_fail(list->fields != NULL); | |
| 267 | ||
| 268 | if (!room->fields) | |
| 269 | f = list->fields->data; | |
| 270 | else | |
| 271 | f = g_list_nth_data(list->fields, g_list_length(room->fields)); | |
| 272 | ||
| 273 | g_return_if_fail(f != NULL); | |
| 274 | ||
| 275 | switch(f->type) { | |
| 15884 | 276 | case PURPLE_ROOMLIST_FIELD_STRING: |
| 8113 | 277 | room->fields = g_list_append(room->fields, g_strdup(field)); |
| 278 | break; | |
| 15884 | 279 | case PURPLE_ROOMLIST_FIELD_BOOL: |
| 280 | case PURPLE_ROOMLIST_FIELD_INT: | |
| 8113 | 281 | room->fields = g_list_append(room->fields, GINT_TO_POINTER(field)); |
| 282 | break; | |
| 283 | } | |
| 284 | } | |
| 285 | ||
| 15884 | 286 | void purple_roomlist_room_join(PurpleRoomlist *list, PurpleRoomlistRoom *room) |
| 8199 | 287 | { |
| 288 | GHashTable *components; | |
| 289 | GList *l, *j; | |
| 15884 | 290 | PurpleConnection *gc; |
| 8199 | 291 | |
| 292 | g_return_if_fail(list != NULL); | |
| 293 | g_return_if_fail(room != NULL); | |
| 294 | ||
| 15884 | 295 | gc = purple_account_get_connection(list->account); |
| 8199 | 296 | if (!gc) |
| 297 | return; | |
| 298 | ||
| 299 | components = g_hash_table_new(g_str_hash, g_str_equal); | |
| 300 | ||
| 301 | g_hash_table_replace(components, "name", room->name); | |
| 302 | for (l = list->fields, j = room->fields; l && j; l = l->next, j = j->next) { | |
| 15884 | 303 | PurpleRoomlistField *f = l->data; |
| 8199 | 304 | |
| 305 | g_hash_table_replace(components, f->name, j->data); | |
| 306 | } | |
| 307 | ||
| 308 | serv_join_chat(gc, components); | |
| 309 | ||
| 310 | g_hash_table_destroy(components); | |
| 311 | } | |
| 312 | ||
|
22134
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
313 | PurpleRoomlistRoomType purple_roomlist_room_get_type(PurpleRoomlistRoom *room) |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
314 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
315 | return room->type; |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
316 | } |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
317 | |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
318 | const char * purple_roomlist_room_get_name(PurpleRoomlistRoom *room) |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
319 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
320 | return room->name; |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
321 | } |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
322 | |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
323 | PurpleRoomlistRoom * purple_roomlist_room_get_parent(PurpleRoomlistRoom *room) |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
324 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
325 | return room->parent; |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
326 | } |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
327 | |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
328 | GList * purple_roomlist_room_get_fields(PurpleRoomlistRoom *room) |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
329 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
330 | return room->fields; |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
331 | } |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
332 | |
| 8113 | 333 | /*@}*/ |
| 334 | ||
| 335 | /**************************************************************************/ | |
| 336 | /** @name Room Field API */ | |
| 337 | /**************************************************************************/ | |
| 338 | /*@{*/ | |
| 339 | ||
| 15884 | 340 | PurpleRoomlistField *purple_roomlist_field_new(PurpleRoomlistFieldType type, |
| 8113 | 341 | const gchar *label, const gchar *name, |
| 342 | gboolean hidden) | |
| 343 | { | |
| 15884 | 344 | PurpleRoomlistField *f; |
| 8113 | 345 | |
| 346 | g_return_val_if_fail(label != NULL, NULL); | |
| 347 | g_return_val_if_fail(name != NULL, NULL); | |
| 348 | ||
| 15884 | 349 | f = g_new0(PurpleRoomlistField, 1); |
| 8113 | 350 | |
| 351 | f->type = type; | |
| 352 | f->label = g_strdup(label); | |
| 353 | f->name = g_strdup(name); | |
| 354 | f->hidden = hidden; | |
| 355 | ||
| 356 | return f; | |
| 357 | } | |
| 358 | ||
|
22134
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
359 | PurpleRoomlistFieldType purple_roomlist_field_get_type(PurpleRoomlistField *field) |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
360 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
361 | return field->type; |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
362 | } |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
363 | |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
364 | const char * purple_roomlist_field_get_label(PurpleRoomlistField *field) |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
365 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
366 | return field->label; |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
367 | } |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
368 | |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
369 | gboolean purple_roomlist_field_get_hidden(PurpleRoomlistField *field) |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
370 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
371 | return field->hidden; |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
372 | } |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
373 | |
| 8113 | 374 | /*@}*/ |
| 375 | ||
| 376 | /**************************************************************************/ | |
| 377 | /** @name UI Registration Functions */ | |
| 378 | /**************************************************************************/ | |
| 379 | /*@{*/ | |
| 380 | ||
| 381 | ||
| 15884 | 382 | void purple_roomlist_set_ui_ops(PurpleRoomlistUiOps *ui_ops) |
| 8113 | 383 | { |
| 384 | ops = ui_ops; | |
| 385 | } | |
| 386 | ||
| 15884 | 387 | PurpleRoomlistUiOps *purple_roomlist_get_ui_ops(void) |
| 8113 | 388 | { |
| 389 | return ops; | |
| 390 | } | |
| 391 | ||
| 392 | /*@}*/ |