Wed, 13 May 2009 20:29:03 +0000
Support custom smileys in MUCs (when all participants support BoB and a maximum
of 10 participants are in the chat).
Always announce support for BoB, since disable custom smileys will still turn
off fetching them, and BoB can be used for other purposes further on.
| 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); | |
|
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
|
176 | g_return_val_if_fail(PURPLE_CONNECTION_IS_CONNECTED(gc), NULL); |
| 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 | prpl = purple_connection_get_prpl(gc); |
| 8113 | 179 | |
|
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
|
180 | 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
|
181 | 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
|
182 | |
|
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 | if(prpl_info && prpl_info->roomlist_get_list) |
| 8113 | 184 | 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
|
185 | |
| 8113 | 186 | return NULL; |
| 187 | } | |
| 188 | ||
| 15884 | 189 | void purple_roomlist_cancel_get_list(PurpleRoomlist *list) |
| 8113 | 190 | { |
|
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
|
191 | PurplePlugin *prpl = NULL; |
| 15884 | 192 | PurplePluginProtocolInfo *prpl_info = NULL; |
| 193 | PurpleConnection *gc; | |
| 8113 | 194 | |
| 195 | g_return_if_fail(list != NULL); | |
| 196 | ||
| 15884 | 197 | gc = purple_account_get_connection(list->account); |
| 8113 | 198 | |
| 199 | g_return_if_fail(gc != NULL); | |
| 200 | ||
|
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
|
201 | 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
|
202 | prpl = purple_connection_get_prpl(gc); |
| 8113 | 203 | |
|
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
|
204 | 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
|
205 | 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
|
206 | |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22134
diff
changeset
|
207 | if(prpl_info && prpl_info->roomlist_cancel) |
| 8113 | 208 | prpl_info->roomlist_cancel(list); |
| 209 | } | |
| 210 | ||
| 15884 | 211 | void purple_roomlist_expand_category(PurpleRoomlist *list, PurpleRoomlistRoom *category) |
| 8113 | 212 | { |
|
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
|
213 | PurplePlugin *prpl = NULL; |
| 15884 | 214 | PurplePluginProtocolInfo *prpl_info = NULL; |
| 215 | PurpleConnection *gc; | |
| 8113 | 216 | |
| 217 | g_return_if_fail(list != NULL); | |
| 8584 | 218 | g_return_if_fail(category != NULL); |
| 15884 | 219 | g_return_if_fail(category->type & PURPLE_ROOMLIST_ROOMTYPE_CATEGORY); |
| 8113 | 220 | |
| 15884 | 221 | gc = purple_account_get_connection(list->account); |
| 8113 | 222 | g_return_if_fail(gc != NULL); |
| 223 | ||
|
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
|
224 | 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
|
225 | prpl = purple_connection_get_prpl(gc); |
| 8113 | 226 | |
|
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
|
227 | 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
|
228 | 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
|
229 | |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22134
diff
changeset
|
230 | if(prpl_info && prpl_info->roomlist_expand_category) |
| 8584 | 231 | prpl_info->roomlist_expand_category(list, category); |
| 8113 | 232 | } |
| 233 | ||
|
22134
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
234 | 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
|
235 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
236 | return list->fields; |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
237 | } |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
238 | |
| 8113 | 239 | /*@}*/ |
| 240 | ||
| 241 | /**************************************************************************/ | |
| 242 | /** @name Room API */ | |
| 243 | /**************************************************************************/ | |
| 244 | /*@{*/ | |
| 245 | ||
| 15884 | 246 | PurpleRoomlistRoom *purple_roomlist_room_new(PurpleRoomlistRoomType type, const gchar *name, |
| 247 | PurpleRoomlistRoom *parent) | |
| 8113 | 248 | { |
| 15884 | 249 | PurpleRoomlistRoom *room; |
| 8113 | 250 | |
| 251 | g_return_val_if_fail(name != NULL, NULL); | |
| 252 | ||
| 15884 | 253 | room = g_new0(PurpleRoomlistRoom, 1); |
| 8113 | 254 | room->type = type; |
| 255 | room->name = g_strdup(name); | |
| 256 | room->parent = parent; | |
| 257 | ||
| 258 | return room; | |
| 259 | } | |
| 260 | ||
| 15884 | 261 | void purple_roomlist_room_add_field(PurpleRoomlist *list, PurpleRoomlistRoom *room, gconstpointer field) |
| 8113 | 262 | { |
| 15884 | 263 | PurpleRoomlistField *f; |
| 8113 | 264 | |
| 265 | g_return_if_fail(list != NULL); | |
| 266 | g_return_if_fail(room != NULL); | |
| 267 | g_return_if_fail(list->fields != NULL); | |
| 268 | ||
|
24814
9e3c1c3b4123
Add a comment to clarify code I initially thought was broken.
Richard Laager <rlaager@pidgin.im>
parents:
22390
diff
changeset
|
269 | /* 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
|
270 | * 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
|
271 | * 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
|
272 | * (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
|
273 | * g_list_length() is one-indexed.) */ |
| 8113 | 274 | if (!room->fields) |
| 275 | f = list->fields->data; | |
| 276 | else | |
| 277 | f = g_list_nth_data(list->fields, g_list_length(room->fields)); | |
| 278 | ||
| 279 | g_return_if_fail(f != NULL); | |
| 280 | ||
| 281 | switch(f->type) { | |
| 15884 | 282 | case PURPLE_ROOMLIST_FIELD_STRING: |
| 8113 | 283 | room->fields = g_list_append(room->fields, g_strdup(field)); |
| 284 | break; | |
| 15884 | 285 | case PURPLE_ROOMLIST_FIELD_BOOL: |
| 286 | case PURPLE_ROOMLIST_FIELD_INT: | |
| 8113 | 287 | room->fields = g_list_append(room->fields, GINT_TO_POINTER(field)); |
| 288 | break; | |
| 289 | } | |
| 290 | } | |
| 291 | ||
| 15884 | 292 | void purple_roomlist_room_join(PurpleRoomlist *list, PurpleRoomlistRoom *room) |
| 8199 | 293 | { |
| 294 | GHashTable *components; | |
| 295 | GList *l, *j; | |
| 15884 | 296 | PurpleConnection *gc; |
| 8199 | 297 | |
| 298 | g_return_if_fail(list != NULL); | |
| 299 | g_return_if_fail(room != NULL); | |
| 300 | ||
| 15884 | 301 | gc = purple_account_get_connection(list->account); |
| 8199 | 302 | if (!gc) |
| 303 | return; | |
| 304 | ||
| 305 | components = g_hash_table_new(g_str_hash, g_str_equal); | |
| 306 | ||
| 307 | g_hash_table_replace(components, "name", room->name); | |
| 308 | for (l = list->fields, j = room->fields; l && j; l = l->next, j = j->next) { | |
| 15884 | 309 | PurpleRoomlistField *f = l->data; |
| 8199 | 310 | |
| 311 | g_hash_table_replace(components, f->name, j->data); | |
| 312 | } | |
| 313 | ||
| 314 | serv_join_chat(gc, components); | |
| 315 | ||
| 316 | g_hash_table_destroy(components); | |
| 317 | } | |
| 318 | ||
|
22134
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
319 | 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
|
320 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
321 | return room->type; |
|
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 | |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
324 | 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
|
325 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
326 | return room->name; |
|
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 | |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
329 | 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
|
330 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
331 | return room->parent; |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
332 | } |
|
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 | 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
|
335 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
336 | return room->fields; |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
337 | } |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
338 | |
| 8113 | 339 | /*@}*/ |
| 340 | ||
| 341 | /**************************************************************************/ | |
| 342 | /** @name Room Field API */ | |
| 343 | /**************************************************************************/ | |
| 344 | /*@{*/ | |
| 345 | ||
| 15884 | 346 | PurpleRoomlistField *purple_roomlist_field_new(PurpleRoomlistFieldType type, |
| 8113 | 347 | const gchar *label, const gchar *name, |
| 348 | gboolean hidden) | |
| 349 | { | |
| 15884 | 350 | PurpleRoomlistField *f; |
| 8113 | 351 | |
| 352 | g_return_val_if_fail(label != NULL, NULL); | |
| 353 | g_return_val_if_fail(name != NULL, NULL); | |
| 354 | ||
| 15884 | 355 | f = g_new0(PurpleRoomlistField, 1); |
| 8113 | 356 | |
| 357 | f->type = type; | |
| 358 | f->label = g_strdup(label); | |
| 359 | f->name = g_strdup(name); | |
| 360 | f->hidden = hidden; | |
| 361 | ||
| 362 | return f; | |
| 363 | } | |
| 364 | ||
|
22134
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
365 | 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
|
366 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
367 | return field->type; |
|
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 | |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
370 | 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
|
371 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
372 | return field->label; |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
373 | } |
|
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 | 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
|
376 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
377 | return field->hidden; |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
378 | } |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
379 | |
| 8113 | 380 | /*@}*/ |
| 381 | ||
| 382 | /**************************************************************************/ | |
| 383 | /** @name UI Registration Functions */ | |
| 384 | /**************************************************************************/ | |
| 385 | /*@{*/ | |
| 386 | ||
| 387 | ||
| 15884 | 388 | void purple_roomlist_set_ui_ops(PurpleRoomlistUiOps *ui_ops) |
| 8113 | 389 | { |
| 390 | ops = ui_ops; | |
| 391 | } | |
| 392 | ||
| 15884 | 393 | PurpleRoomlistUiOps *purple_roomlist_get_ui_ops(void) |
| 8113 | 394 | { |
| 395 | return ops; | |
| 396 | } | |
| 397 | ||
| 398 | /*@}*/ |