Thu, 13 May 2010 05:06:46 +0000
ChangeLog Elliott's fix for buddy icons on MSN.
| 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 | ||
|
18265
9f26190d7f46
Move the define in internal.h instead.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15884
diff
changeset
|
27 | #include "internal.h" |
|
9f26190d7f46
Move the define in internal.h instead.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15884
diff
changeset
|
28 | |
| 8113 | 29 | #include "account.h" |
| 30 | #include "connection.h" | |
| 31 | #include "debug.h" | |
| 32 | #include "roomlist.h" | |
| 8199 | 33 | #include "server.h" |
| 8113 | 34 | |
| 35 | ||
| 15884 | 36 | static PurpleRoomlistUiOps *ops = NULL; |
| 8113 | 37 | |
| 38 | /**************************************************************************/ | |
| 39 | /** @name Room List API */ | |
| 40 | /**************************************************************************/ | |
| 41 | /*@{*/ | |
| 42 | ||
| 15884 | 43 | void purple_roomlist_show_with_account(PurpleAccount *account) |
| 8352 | 44 | { |
| 45 | if (ops && ops->show_with_account) | |
| 46 | ops->show_with_account(account); | |
| 47 | } | |
| 48 | ||
| 15884 | 49 | PurpleRoomlist *purple_roomlist_new(PurpleAccount *account) |
| 8113 | 50 | { |
| 15884 | 51 | PurpleRoomlist *list; |
| 8113 | 52 | |
| 53 | g_return_val_if_fail(account != NULL, NULL); | |
| 54 | ||
| 15884 | 55 | list = g_new0(PurpleRoomlist, 1); |
| 8113 | 56 | list->account = account; |
| 57 | list->rooms = NULL; | |
| 58 | list->fields = NULL; | |
| 59 | list->ref = 1; | |
| 60 | ||
| 10027 | 61 | if (ops && ops->create) |
| 62 | ops->create(list); | |
| 8113 | 63 | |
| 64 | return list; | |
| 65 | } | |
| 66 | ||
| 15884 | 67 | void purple_roomlist_ref(PurpleRoomlist *list) |
| 8113 | 68 | { |
| 69 | g_return_if_fail(list != NULL); | |
| 70 | ||
| 71 | list->ref++; | |
| 15884 | 72 | purple_debug_misc("roomlist", "reffing list, ref count now %d\n", list->ref); |
| 8113 | 73 | } |
| 74 | ||
| 15884 | 75 | static void purple_roomlist_room_destroy(PurpleRoomlist *list, PurpleRoomlistRoom *r) |
| 8113 | 76 | { |
| 77 | GList *l, *j; | |
| 78 | ||
| 79 | for (l = list->fields, j = r->fields; l && j; l = l->next, j = j->next) { | |
| 15884 | 80 | PurpleRoomlistField *f = l->data; |
| 81 | if (f->type == PURPLE_ROOMLIST_FIELD_STRING) | |
| 8113 | 82 | g_free(j->data); |
| 83 | } | |
| 84 | ||
| 85 | g_list_free(r->fields); | |
| 86 | g_free(r->name); | |
| 87 | g_free(r); | |
| 88 | } | |
| 89 | ||
| 15884 | 90 | static void purple_roomlist_field_destroy(PurpleRoomlistField *f) |
| 8113 | 91 | { |
| 92 | g_free(f->label); | |
| 93 | g_free(f->name); | |
| 94 | g_free(f); | |
| 95 | } | |
| 96 | ||
| 15884 | 97 | static void purple_roomlist_destroy(PurpleRoomlist *list) |
| 8113 | 98 | { |
| 99 | GList *l; | |
| 100 | ||
| 15884 | 101 | purple_debug_misc("roomlist", "destroying list %p\n", list); |
| 8113 | 102 | |
| 103 | if (ops && ops->destroy) | |
| 104 | ops->destroy(list); | |
| 105 | ||
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
12250
diff
changeset
|
106 | for (l = list->rooms; l; l = l->next) { |
| 15884 | 107 | PurpleRoomlistRoom *r = l->data; |
| 108 | purple_roomlist_room_destroy(list, r); | |
| 8113 | 109 | } |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
12250
diff
changeset
|
110 | g_list_free(list->rooms); |
| 8113 | 111 | |
| 15884 | 112 | 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
|
113 | g_list_free(list->fields); |
| 8113 | 114 | |
| 115 | g_free(list); | |
| 116 | } | |
| 117 | ||
| 15884 | 118 | void purple_roomlist_unref(PurpleRoomlist *list) |
| 8113 | 119 | { |
| 120 | g_return_if_fail(list != NULL); | |
|
12250
5b14301dd1ec
[gaim-migrate @ 14552]
Richard Laager <rlaager@pidgin.im>
parents:
10027
diff
changeset
|
121 | g_return_if_fail(list->ref > 0); |
| 8113 | 122 | |
| 123 | list->ref--; | |
| 124 | ||
| 15884 | 125 | purple_debug_misc("roomlist", "unreffing list, ref count now %d\n", list->ref); |
| 8113 | 126 | if (list->ref == 0) |
| 15884 | 127 | purple_roomlist_destroy(list); |
| 8113 | 128 | } |
| 129 | ||
| 15884 | 130 | void purple_roomlist_set_fields(PurpleRoomlist *list, GList *fields) |
| 8113 | 131 | { |
| 132 | g_return_if_fail(list != NULL); | |
| 133 | ||
| 134 | list->fields = fields; | |
| 135 | ||
| 136 | if (ops && ops->set_fields) | |
| 137 | ops->set_fields(list, fields); | |
| 138 | } | |
| 139 | ||
| 15884 | 140 | void purple_roomlist_set_in_progress(PurpleRoomlist *list, gboolean in_progress) |
| 8113 | 141 | { |
| 142 | g_return_if_fail(list != NULL); | |
| 143 | ||
| 8199 | 144 | list->in_progress = in_progress; |
| 145 | ||
| 8113 | 146 | if (ops && ops->in_progress) |
| 147 | ops->in_progress(list, in_progress); | |
| 148 | } | |
| 149 | ||
| 15884 | 150 | gboolean purple_roomlist_get_in_progress(PurpleRoomlist *list) |
| 8199 | 151 | { |
| 152 | g_return_val_if_fail(list != NULL, FALSE); | |
| 153 | ||
| 154 | return list->in_progress; | |
| 155 | } | |
| 156 | ||
| 15884 | 157 | void purple_roomlist_room_add(PurpleRoomlist *list, PurpleRoomlistRoom *room) |
| 8113 | 158 | { |
| 159 | g_return_if_fail(list != NULL); | |
| 160 | g_return_if_fail(room != NULL); | |
| 161 | ||
| 162 | list->rooms = g_list_append(list->rooms, room); | |
| 163 | ||
| 164 | if (ops && ops->add_room) | |
| 165 | ops->add_room(list, room); | |
| 166 | } | |
| 167 | ||
| 15884 | 168 | PurpleRoomlist *purple_roomlist_get_list(PurpleConnection *gc) |
| 8113 | 169 | { |
|
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
|
170 | PurplePlugin *prpl = NULL; |
| 15884 | 171 | PurplePluginProtocolInfo *prpl_info = NULL; |
| 8113 | 172 | |
| 173 | g_return_val_if_fail(gc != NULL, NULL); | |
|
24863
68c109ca0089
Fix a crash that happens when accessing the roomlist for an account that's
Paul Aurich <darkrain42@pidgin.im>
parents:
24814
diff
changeset
|
174 | g_return_val_if_fail(PURPLE_CONNECTION_IS_CONNECTED(gc), NULL); |
| 8113 | 175 | |
|
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
|
176 | prpl = purple_connection_get_prpl(gc); |
| 8113 | 177 | |
|
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
|
178 | 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
|
179 | 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
|
180 | |
|
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 | if(prpl_info && prpl_info->roomlist_get_list) |
| 8113 | 182 | 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
|
183 | |
| 8113 | 184 | return NULL; |
| 185 | } | |
| 186 | ||
| 15884 | 187 | void purple_roomlist_cancel_get_list(PurpleRoomlist *list) |
| 8113 | 188 | { |
|
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
|
189 | PurplePlugin *prpl = NULL; |
| 15884 | 190 | PurplePluginProtocolInfo *prpl_info = NULL; |
| 191 | PurpleConnection *gc; | |
| 8113 | 192 | |
| 193 | g_return_if_fail(list != NULL); | |
| 194 | ||
| 15884 | 195 | gc = purple_account_get_connection(list->account); |
| 8113 | 196 | |
| 197 | g_return_if_fail(gc != NULL); | |
| 198 | ||
|
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
|
199 | 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
|
200 | prpl = purple_connection_get_prpl(gc); |
| 8113 | 201 | |
|
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
|
202 | 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
|
203 | 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
|
204 | |
|
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 | if(prpl_info && prpl_info->roomlist_cancel) |
| 8113 | 206 | prpl_info->roomlist_cancel(list); |
| 207 | } | |
| 208 | ||
| 15884 | 209 | void purple_roomlist_expand_category(PurpleRoomlist *list, PurpleRoomlistRoom *category) |
| 8113 | 210 | { |
|
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
|
211 | PurplePlugin *prpl = NULL; |
| 15884 | 212 | PurplePluginProtocolInfo *prpl_info = NULL; |
| 213 | PurpleConnection *gc; | |
| 8113 | 214 | |
| 215 | g_return_if_fail(list != NULL); | |
| 8584 | 216 | g_return_if_fail(category != NULL); |
| 15884 | 217 | g_return_if_fail(category->type & PURPLE_ROOMLIST_ROOMTYPE_CATEGORY); |
| 8113 | 218 | |
| 15884 | 219 | gc = purple_account_get_connection(list->account); |
| 8113 | 220 | g_return_if_fail(gc != NULL); |
| 221 | ||
|
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
|
222 | 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
|
223 | prpl = purple_connection_get_prpl(gc); |
| 8113 | 224 | |
|
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
|
225 | 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
|
226 | 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
|
227 | |
|
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 | if(prpl_info && prpl_info->roomlist_expand_category) |
| 8584 | 229 | prpl_info->roomlist_expand_category(list, category); |
| 8113 | 230 | } |
| 231 | ||
|
22134
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
232 | 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
|
233 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
234 | return list->fields; |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
235 | } |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
236 | |
| 8113 | 237 | /*@}*/ |
| 238 | ||
| 239 | /**************************************************************************/ | |
| 240 | /** @name Room API */ | |
| 241 | /**************************************************************************/ | |
| 242 | /*@{*/ | |
| 243 | ||
| 15884 | 244 | PurpleRoomlistRoom *purple_roomlist_room_new(PurpleRoomlistRoomType type, const gchar *name, |
| 245 | PurpleRoomlistRoom *parent) | |
| 8113 | 246 | { |
| 15884 | 247 | PurpleRoomlistRoom *room; |
| 8113 | 248 | |
| 249 | g_return_val_if_fail(name != NULL, NULL); | |
| 250 | ||
| 15884 | 251 | room = g_new0(PurpleRoomlistRoom, 1); |
| 8113 | 252 | room->type = type; |
| 253 | room->name = g_strdup(name); | |
| 254 | room->parent = parent; | |
| 255 | ||
| 256 | return room; | |
| 257 | } | |
| 258 | ||
| 15884 | 259 | void purple_roomlist_room_add_field(PurpleRoomlist *list, PurpleRoomlistRoom *room, gconstpointer field) |
| 8113 | 260 | { |
| 15884 | 261 | PurpleRoomlistField *f; |
| 8113 | 262 | |
| 263 | g_return_if_fail(list != NULL); | |
| 264 | g_return_if_fail(room != NULL); | |
| 265 | g_return_if_fail(list->fields != NULL); | |
| 266 | ||
|
24814
9e3c1c3b4123
Add a comment to clarify code I initially thought was broken.
Richard Laager <rlaager@pidgin.im>
parents:
22390
diff
changeset
|
267 | /* If this is the first call for this room, grab the first field in |
|
9e3c1c3b4123
Add a comment to clarify code I initially thought was broken.
Richard Laager <rlaager@pidgin.im>
parents:
22390
diff
changeset
|
268 | * the Roomlist's fields. Otherwise, grab the field that is one |
|
9e3c1c3b4123
Add a comment to clarify code I initially thought was broken.
Richard Laager <rlaager@pidgin.im>
parents:
22390
diff
changeset
|
269 | * more than the number of fields already present for the room. |
|
9e3c1c3b4123
Add a comment to clarify code I initially thought was broken.
Richard Laager <rlaager@pidgin.im>
parents:
22390
diff
changeset
|
270 | * (This works because g_list_nth_data() is zero-indexed and |
|
9e3c1c3b4123
Add a comment to clarify code I initially thought was broken.
Richard Laager <rlaager@pidgin.im>
parents:
22390
diff
changeset
|
271 | * g_list_length() is one-indexed.) */ |
| 8113 | 272 | if (!room->fields) |
| 273 | f = list->fields->data; | |
| 274 | else | |
| 275 | f = g_list_nth_data(list->fields, g_list_length(room->fields)); | |
| 276 | ||
| 277 | g_return_if_fail(f != NULL); | |
| 278 | ||
| 279 | switch(f->type) { | |
| 15884 | 280 | case PURPLE_ROOMLIST_FIELD_STRING: |
| 8113 | 281 | room->fields = g_list_append(room->fields, g_strdup(field)); |
| 282 | break; | |
| 15884 | 283 | case PURPLE_ROOMLIST_FIELD_BOOL: |
| 284 | case PURPLE_ROOMLIST_FIELD_INT: | |
| 8113 | 285 | room->fields = g_list_append(room->fields, GINT_TO_POINTER(field)); |
| 286 | break; | |
| 287 | } | |
| 288 | } | |
| 289 | ||
| 15884 | 290 | void purple_roomlist_room_join(PurpleRoomlist *list, PurpleRoomlistRoom *room) |
| 8199 | 291 | { |
| 292 | GHashTable *components; | |
| 293 | GList *l, *j; | |
| 15884 | 294 | PurpleConnection *gc; |
| 8199 | 295 | |
| 296 | g_return_if_fail(list != NULL); | |
| 297 | g_return_if_fail(room != NULL); | |
| 298 | ||
| 15884 | 299 | gc = purple_account_get_connection(list->account); |
| 8199 | 300 | if (!gc) |
| 301 | return; | |
| 302 | ||
| 303 | components = g_hash_table_new(g_str_hash, g_str_equal); | |
| 304 | ||
| 305 | g_hash_table_replace(components, "name", room->name); | |
| 306 | for (l = list->fields, j = room->fields; l && j; l = l->next, j = j->next) { | |
| 15884 | 307 | PurpleRoomlistField *f = l->data; |
| 8199 | 308 | |
| 309 | g_hash_table_replace(components, f->name, j->data); | |
| 310 | } | |
| 311 | ||
| 312 | serv_join_chat(gc, components); | |
| 313 | ||
| 314 | g_hash_table_destroy(components); | |
| 315 | } | |
| 316 | ||
|
22134
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
317 | 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
|
318 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
319 | return room->type; |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
320 | } |
|
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 | 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
|
323 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
324 | return room->name; |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
325 | } |
|
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 | 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
|
328 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
329 | return room->parent; |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
330 | } |
|
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 | 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
|
333 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
334 | return room->fields; |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
335 | } |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
336 | |
| 8113 | 337 | /*@}*/ |
| 338 | ||
| 339 | /**************************************************************************/ | |
| 340 | /** @name Room Field API */ | |
| 341 | /**************************************************************************/ | |
| 342 | /*@{*/ | |
| 343 | ||
| 15884 | 344 | PurpleRoomlistField *purple_roomlist_field_new(PurpleRoomlistFieldType type, |
| 8113 | 345 | const gchar *label, const gchar *name, |
| 346 | gboolean hidden) | |
| 347 | { | |
| 15884 | 348 | PurpleRoomlistField *f; |
| 8113 | 349 | |
| 350 | g_return_val_if_fail(label != NULL, NULL); | |
| 351 | g_return_val_if_fail(name != NULL, NULL); | |
| 352 | ||
| 15884 | 353 | f = g_new0(PurpleRoomlistField, 1); |
| 8113 | 354 | |
| 355 | f->type = type; | |
| 356 | f->label = g_strdup(label); | |
| 357 | f->name = g_strdup(name); | |
| 358 | f->hidden = hidden; | |
| 359 | ||
| 360 | return f; | |
| 361 | } | |
| 362 | ||
|
22134
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
363 | 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
|
364 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
365 | return field->type; |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
366 | } |
|
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 | 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
|
369 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
370 | return field->label; |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
371 | } |
|
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 | 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
|
374 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
375 | return field->hidden; |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
376 | } |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
377 | |
| 8113 | 378 | /*@}*/ |
| 379 | ||
| 380 | /**************************************************************************/ | |
| 381 | /** @name UI Registration Functions */ | |
| 382 | /**************************************************************************/ | |
| 383 | /*@{*/ | |
| 384 | ||
| 385 | ||
| 15884 | 386 | void purple_roomlist_set_ui_ops(PurpleRoomlistUiOps *ui_ops) |
| 8113 | 387 | { |
| 388 | ops = ui_ops; | |
| 389 | } | |
| 390 | ||
| 15884 | 391 | PurpleRoomlistUiOps *purple_roomlist_get_ui_ops(void) |
| 8113 | 392 | { |
| 393 | return ops; | |
| 394 | } | |
| 395 | ||
| 396 | /*@}*/ |