comparison src/roomlist.c @ 8939:19885cb8a24c

[gaim-migrate @ 9709] Handle graying out the roomlist menu item in a more sane way. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sat, 15 May 2004 23:04:08 +0000
parents fd1a4ff1f7ed
children 5151c6788f3d
comparison
equal deleted inserted replaced
8938:88ec59dec95a 8939:19885cb8a24c
36 36
37 /**************************************************************************/ 37 /**************************************************************************/
38 /** @name Room List API */ 38 /** @name Room List API */
39 /**************************************************************************/ 39 /**************************************************************************/
40 /*@{*/ 40 /*@{*/
41
42 gboolean gaim_roomlist_is_showable()
43 {
44 if (gaim_roomlist_get_first_valid_account() != NULL)
45 return TRUE;
46 return FALSE;
47 }
48
49 GaimAccount *gaim_roomlist_get_first_valid_account()
50 {
51 GList *c;
52 GaimConnection *gc;
53 GaimAccount *first_account = NULL;
54
55 for (c = gaim_connections_get_all(); c != NULL; c = c->next) {
56 gc = c->data;
57
58 if (gaim_roomlist_is_possible(gc)) {
59 first_account = gaim_connection_get_account(gc);
60 break;
61 }
62 }
63
64 return first_account;
65 }
66 41
67 void gaim_roomlist_show_with_account(GaimAccount *account) 42 void gaim_roomlist_show_with_account(GaimAccount *account)
68 { 43 {
69 if (ops && ops->show_with_account) 44 if (ops && ops->show_with_account)
70 ops->show_with_account(account); 45 ops->show_with_account(account);
191 166
192 list->rooms = g_list_append(list->rooms, room); 167 list->rooms = g_list_append(list->rooms, room);
193 168
194 if (ops && ops->add_room) 169 if (ops && ops->add_room)
195 ops->add_room(list, room); 170 ops->add_room(list, room);
196 }
197
198 gboolean gaim_roomlist_is_possible(GaimConnection *gc)
199 {
200 GaimPluginProtocolInfo *prpl_info = NULL;
201
202 g_return_val_if_fail(gc != NULL, FALSE);
203
204 if (gc->prpl != NULL)
205 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
206
207 if (prpl_info && prpl_info->roomlist_get_list)
208 return TRUE;
209 return FALSE;
210 } 171 }
211 172
212 GaimRoomlist *gaim_roomlist_get_list(GaimConnection *gc) 173 GaimRoomlist *gaim_roomlist_get_list(GaimConnection *gc)
213 { 174 {
214 GaimPluginProtocolInfo *prpl_info = NULL; 175 GaimPluginProtocolInfo *prpl_info = NULL;