comparison src/roomlist.c @ 8199:12055bae7f59

[gaim-migrate @ 8922] marv made the roomlist widget a lot cooler. thanks marv! committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Sun, 01 Feb 2004 05:02:13 +0000
parents 596c64a2a2d0
children 77baefe979c6
comparison
equal deleted inserted replaced
8198:9f174d0222bd 8199:12055bae7f59
27 27
28 #include "account.h" 28 #include "account.h"
29 #include "connection.h" 29 #include "connection.h"
30 #include "debug.h" 30 #include "debug.h"
31 #include "roomlist.h" 31 #include "roomlist.h"
32 #include "server.h"
32 33
33 34
34 static GaimRoomlistUiOps *ops = NULL; 35 static GaimRoomlistUiOps *ops = NULL;
35 36
36 /**************************************************************************/ 37 /**************************************************************************/
137 138
138 void gaim_roomlist_set_in_progress(GaimRoomlist *list, gboolean in_progress) 139 void gaim_roomlist_set_in_progress(GaimRoomlist *list, gboolean in_progress)
139 { 140 {
140 g_return_if_fail(list != NULL); 141 g_return_if_fail(list != NULL);
141 142
143 list->in_progress = in_progress;
144
142 if (ops && ops->in_progress) 145 if (ops && ops->in_progress)
143 ops->in_progress(list, in_progress); 146 ops->in_progress(list, in_progress);
147 }
148
149 gboolean gaim_roomlist_get_in_progress(GaimRoomlist *list)
150 {
151 g_return_val_if_fail(list != NULL, FALSE);
152
153 return list->in_progress;
144 } 154 }
145 155
146 void gaim_roomlist_room_add(GaimRoomlist *list, GaimRoomlistRoom *room) 156 void gaim_roomlist_room_add(GaimRoomlist *list, GaimRoomlistRoom *room)
147 { 157 {
148 g_return_if_fail(list != NULL); 158 g_return_if_fail(list != NULL);
265 room->fields = g_list_append(room->fields, GINT_TO_POINTER(field)); 275 room->fields = g_list_append(room->fields, GINT_TO_POINTER(field));
266 break; 276 break;
267 } 277 }
268 } 278 }
269 279
280 void gaim_roomlist_room_join(GaimRoomlist *list, GaimRoomlistRoom *room)
281 {
282 GHashTable *components;
283 GList *l, *j;
284 GaimConnection *gc;
285
286 g_return_if_fail(list != NULL);
287 g_return_if_fail(room != NULL);
288
289 gc = gaim_account_get_connection(list->account);
290 if (!gc)
291 return;
292
293 components = g_hash_table_new(g_str_hash, g_str_equal);
294
295 g_hash_table_replace(components, "name", room->name);
296 for (l = list->fields, j = room->fields; l && j; l = l->next, j = j->next) {
297 GaimRoomlistField *f = l->data;
298
299 g_hash_table_replace(components, f->name, j->data);
300 }
301
302 serv_join_chat(gc, components);
303
304 g_hash_table_destroy(components);
305 }
306
270 /*@}*/ 307 /*@}*/
271 308
272 /**************************************************************************/ 309 /**************************************************************************/
273 /** @name Room Field API */ 310 /** @name Room Field API */
274 /**************************************************************************/ 311 /**************************************************************************/