annotate src/roomlist.c @ 8352:77baefe979c6

[gaim-migrate @ 9076] this compiles, and I don't think it breaks anything, so here's /list support, again from our patient friend marv committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Fri, 27 Feb 2004 01:48:11 +0000
parents 12055bae7f59
children 058efd3cb86f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
1 /**
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
2 * @file roomlist.c Room List API
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
3 * @ingroup core
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
4 *
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
5 * gaim
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
6 *
8146
596c64a2a2d0 [gaim-migrate @ 8854]
Luke Schierer <lschiere@pidgin.im>
parents: 8113
diff changeset
7 * Gaim is the legal property of its developers, whose names are too numerous
596c64a2a2d0 [gaim-migrate @ 8854]
Luke Schierer <lschiere@pidgin.im>
parents: 8113
diff changeset
8 * to list here. Please refer to the COPYRIGHT file distributed with this
596c64a2a2d0 [gaim-migrate @ 8854]
Luke Schierer <lschiere@pidgin.im>
parents: 8113
diff changeset
9 * source distribution.
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
10 *
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
14 * (at your option) any later version.
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
15 *
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
16 * This program is distributed in the hope that it will be useful,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
19 * GNU General Public License for more details.
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
20 *
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
22 * along with this program; if not, write to the Free Software
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
24 */
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
25
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
26 #include <glib.h>
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
27
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
28 #include "account.h"
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
29 #include "connection.h"
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
30 #include "debug.h"
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
31 #include "roomlist.h"
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
32 #include "server.h"
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
33
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
34
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
35 static GaimRoomlistUiOps *ops = NULL;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
36
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
37 /**************************************************************************/
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
38 /** @name Room List API */
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
39 /**************************************************************************/
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
40 /*@{*/
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
41
8352
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8199
diff changeset
42 void gaim_roomlist_show_with_account(GaimAccount *account)
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8199
diff changeset
43 {
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8199
diff changeset
44 if (ops && ops->show_with_account)
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8199
diff changeset
45 ops->show_with_account(account);
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8199
diff changeset
46 }
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8199
diff changeset
47
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
48 GaimRoomlist *gaim_roomlist_new(GaimAccount *account)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
49 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
50 GaimRoomlist *list;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
51
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
52 g_return_val_if_fail(account != NULL, NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
53
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
54 list = g_new0(GaimRoomlist, 1);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
55 list->account = account;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
56 list->rooms = NULL;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
57 list->fields = NULL;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
58 list->ref = 1;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
59
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
60 if (ops && ops->new)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
61 ops->new(list);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
62
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
63 return list;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
64 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
65
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
66 void gaim_roomlist_ref(GaimRoomlist *list)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
67 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
68 g_return_if_fail(list != NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
69
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
70 list->ref++;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
71 gaim_debug_misc("roomlist", "reffing list, ref count now %d\n", list->ref);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
72 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
73
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
74 static void gaim_roomlist_room_destroy(GaimRoomlist *list, GaimRoomlistRoom *r)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
75 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
76 GList *l, *j;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
77
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
78 for (l = list->fields, j = r->fields; l && j; l = l->next, j = j->next) {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
79 GaimRoomlistField *f = l->data;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
80 if (f->type == GAIM_ROOMLIST_FIELD_STRING)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
81 g_free(j->data);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
82 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
83
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
84 g_list_free(r->fields);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
85 g_free(r->name);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
86 g_free(r);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
87 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
88
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
89 static void gaim_roomlist_field_destroy(GaimRoomlistField *f)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
90 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
91 g_free(f->label);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
92 g_free(f->name);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
93 g_free(f);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
94 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
95
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
96 static void gaim_roomlist_destroy(GaimRoomlist *list)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
97 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
98 GList *l;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
99
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
100 gaim_debug_misc("roomlist", "destroying list %p\n", list);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
101
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
102 if (ops && ops->destroy)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
103 ops->destroy(list);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
104
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
105 if (list->rooms) {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
106 for (l = list->rooms; l; l = l->next) {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
107 GaimRoomlistRoom *r = l->data;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
108 gaim_roomlist_room_destroy(list, r);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
109 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
110 g_list_free(list->rooms);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
111 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
112
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
113 if (list->fields) {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
114 for (l = list->fields; l; l = l->next) {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
115 GaimRoomlistField *f = l->data;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
116 gaim_roomlist_field_destroy(f);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
117 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
118 g_list_free(list->fields);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
119 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
120
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
121 g_free(list);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
122 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
123
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
124 void gaim_roomlist_unref(GaimRoomlist *list)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
125 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
126 g_return_if_fail(list != NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
127
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
128 list->ref--;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
129
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
130 gaim_debug_misc("roomlist", "unreffing list, ref count now %d\n", list->ref);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
131 if (list->ref == 0)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
132 gaim_roomlist_destroy(list);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
133 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
134
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
135 void gaim_roomlist_set_fields(GaimRoomlist *list, GList *fields)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
136 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
137 g_return_if_fail(list != NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
138
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
139 list->fields = fields;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
140
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
141 if (ops && ops->set_fields)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
142 ops->set_fields(list, fields);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
143 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
144
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
145 void gaim_roomlist_set_in_progress(GaimRoomlist *list, gboolean in_progress)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
146 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
147 g_return_if_fail(list != NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
148
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
149 list->in_progress = in_progress;
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
150
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
151 if (ops && ops->in_progress)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
152 ops->in_progress(list, in_progress);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
153 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
154
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
155 gboolean gaim_roomlist_get_in_progress(GaimRoomlist *list)
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
156 {
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
157 g_return_val_if_fail(list != NULL, FALSE);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
158
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
159 return list->in_progress;
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
160 }
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
161
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
162 void gaim_roomlist_room_add(GaimRoomlist *list, GaimRoomlistRoom *room)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
163 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
164 g_return_if_fail(list != NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
165 g_return_if_fail(room != NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
166
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
167 list->rooms = g_list_append(list->rooms, room);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
168
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
169 if (ops && ops->add_room)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
170 ops->add_room(list, room);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
171 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
172
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
173 gboolean gaim_roomlist_is_possible(GaimConnection *gc)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
174 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
175 GaimPluginProtocolInfo *prpl_info = NULL;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
176
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
177 g_return_val_if_fail(gc != NULL, FALSE);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
178
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
179 if (gc->prpl != NULL)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
180 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
181
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
182 if (prpl_info && prpl_info->roomlist_get_list)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
183 return TRUE;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
184 return FALSE;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
185 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
186
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
187 GaimRoomlist *gaim_roomlist_get_list(GaimConnection *gc)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
188 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
189 GaimPluginProtocolInfo *prpl_info = NULL;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
190
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
191 g_return_val_if_fail(gc != NULL, NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
192
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
193 if (gc->prpl != NULL)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
194 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
195
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
196 if (prpl_info && prpl_info->roomlist_get_list)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
197 return prpl_info->roomlist_get_list(gc);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
198 return NULL;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
199 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
200
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
201 void gaim_roomlist_cancel_get_list(GaimRoomlist *list)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
202 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
203 GaimPluginProtocolInfo *prpl_info = NULL;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
204 GaimConnection *gc;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
205
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
206 g_return_if_fail(list != NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
207
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
208 gc = gaim_account_get_connection(list->account);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
209
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
210 g_return_if_fail(gc != NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
211
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
212 if (gc != NULL && gc->prpl != NULL)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
213 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
214
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
215 if (prpl_info && prpl_info->roomlist_cancel)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
216 prpl_info->roomlist_cancel(list);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
217 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
218
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
219 void gaim_roomlist_expand_catagory(GaimRoomlist *list, GaimRoomlistRoom *catagory)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
220 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
221 GaimPluginProtocolInfo *prpl_info = NULL;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
222 GaimConnection *gc;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
223
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
224 g_return_if_fail(list != NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
225 g_return_if_fail(catagory != NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
226 g_return_if_fail(catagory->type & GAIM_ROOMLIST_ROOMTYPE_CATAGORY);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
227
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
228 gc = gaim_account_get_connection(list->account);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
229 g_return_if_fail(gc != NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
230
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
231 if (gc->prpl != NULL)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
232 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
233
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
234 if (prpl_info && prpl_info->roomlist_expand_catagory)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
235 prpl_info->roomlist_expand_catagory(list, catagory);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
236 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
237
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
238 /*@}*/
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
239
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
240 /**************************************************************************/
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
241 /** @name Room API */
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
242 /**************************************************************************/
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
243 /*@{*/
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
244
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
245 GaimRoomlistRoom *gaim_roomlist_room_new(GaimRoomlistRoomType type, const gchar *name,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
246 GaimRoomlistRoom *parent)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
247 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
248 GaimRoomlistRoom *room;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
249
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
250 g_return_val_if_fail(name != NULL, NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
251
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
252 room = g_new0(GaimRoomlistRoom, 1);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
253 room->type = type;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
254 room->name = g_strdup(name);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
255 room->parent = parent;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
256
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
257 return room;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
258 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
259
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
260 void gaim_roomlist_room_add_field(GaimRoomlist *list, GaimRoomlistRoom *room, gconstpointer field)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
261 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
262 GaimRoomlistField *f;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
263
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
264 g_return_if_fail(list != NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
265 g_return_if_fail(room != NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
266 g_return_if_fail(list->fields != NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
267
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
268 if (!room->fields)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
269 f = list->fields->data;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
270 else
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
271 f = g_list_nth_data(list->fields, g_list_length(room->fields));
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
272
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
273 g_return_if_fail(f != NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
274
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
275 switch(f->type) {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
276 case GAIM_ROOMLIST_FIELD_STRING:
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
277 room->fields = g_list_append(room->fields, g_strdup(field));
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
278 break;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
279 case GAIM_ROOMLIST_FIELD_BOOL:
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
280 case GAIM_ROOMLIST_FIELD_INT:
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
281 room->fields = g_list_append(room->fields, GINT_TO_POINTER(field));
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
282 break;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
283 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
284 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
285
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
286 void gaim_roomlist_room_join(GaimRoomlist *list, GaimRoomlistRoom *room)
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
287 {
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
288 GHashTable *components;
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
289 GList *l, *j;
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
290 GaimConnection *gc;
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
291
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
292 g_return_if_fail(list != NULL);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
293 g_return_if_fail(room != NULL);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
294
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
295 gc = gaim_account_get_connection(list->account);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
296 if (!gc)
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
297 return;
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
298
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
299 components = g_hash_table_new(g_str_hash, g_str_equal);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
300
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
301 g_hash_table_replace(components, "name", room->name);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
302 for (l = list->fields, j = room->fields; l && j; l = l->next, j = j->next) {
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
303 GaimRoomlistField *f = l->data;
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
304
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
305 g_hash_table_replace(components, f->name, j->data);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
306 }
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
307
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
308 serv_join_chat(gc, components);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
309
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
310 g_hash_table_destroy(components);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
311 }
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
312
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
313 /*@}*/
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
314
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
315 /**************************************************************************/
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
316 /** @name Room Field API */
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
317 /**************************************************************************/
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
318 /*@{*/
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
319
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
320 GaimRoomlistField *gaim_roomlist_field_new(GaimRoomlistFieldType type,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
321 const gchar *label, const gchar *name,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
322 gboolean hidden)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
323 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
324 GaimRoomlistField *f;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
325
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
326 g_return_val_if_fail(label != NULL, NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
327 g_return_val_if_fail(name != NULL, NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
328
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
329 f = g_new0(GaimRoomlistField, 1);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
330
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
331 f->type = type;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
332 f->label = g_strdup(label);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
333 f->name = g_strdup(name);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
334 f->hidden = hidden;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
335
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
336 return f;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
337 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
338
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
339 /*@}*/
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
340
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
341 /**************************************************************************/
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
342 /** @name UI Registration Functions */
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
343 /**************************************************************************/
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
344 /*@{*/
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
345
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
346
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
347 void gaim_roomlist_set_ui_ops(GaimRoomlistUiOps *ui_ops)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
348 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
349 ops = ui_ops;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
350 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
351
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
352 GaimRoomlistUiOps *gaim_roomlist_get_ui_ops(void)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
353 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
354 return ops;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
355 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
356
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
357 /*@}*/