Mercurial > pidgin.yaz
annotate src/buddyicon.c @ 7289:ab2085024a29
[gaim-migrate @ 7870]
Let new MSN users with empty buddy lists sign on. This fixes a lot of bug
numbers.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Fri, 17 Oct 2003 15:03:27 +0000 |
parents | 208cb260d7a7 |
children | 1c8830db0189 |
rev | line source |
---|---|
6846 | 1 /** |
2 * @file icon.c Buddy Icon API | |
3 * @ingroup core | |
4 * | |
5 * gaim | |
6 * | |
7 * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org> | |
8 * | |
9 * This program is free software; you can redistribute it and/or modify | |
10 * it under the terms of the GNU General Public License as published by | |
11 * the Free Software Foundation; either version 2 of the License, or | |
12 * (at your option) any later version. | |
13 * | |
14 * This program is distributed in the hope that it will be useful, | |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 * GNU General Public License for more details. | |
18 * | |
19 * You should have received a copy of the GNU General Public License | |
20 * along with this program; if not, write to the Free Software | |
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
22 */ | |
23 #include "internal.h" | |
24 #include "buddyicon.h" | |
25 #include "conversation.h" | |
6886
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
26 #include "debug.h" |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
27 #include "util.h" |
6846 | 28 |
29 static GHashTable *account_cache = NULL; | |
6886
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
30 static char *cache_dir = NULL; |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
31 static gboolean icon_caching = TRUE; |
6846 | 32 |
33 GaimBuddyIcon * | |
34 gaim_buddy_icon_new(GaimAccount *account, const char *username, | |
35 void *icon_data, size_t icon_len) | |
36 { | |
37 GaimBuddyIcon *icon; | |
38 | |
39 g_return_val_if_fail(account != NULL, NULL); | |
40 g_return_val_if_fail(username != NULL, NULL); | |
41 g_return_val_if_fail(icon_data != NULL, NULL); | |
42 g_return_val_if_fail(icon_len > 0, NULL); | |
43 | |
44 icon = gaim_buddy_icons_find(account, username); | |
45 | |
46 if (icon == NULL) | |
47 { | |
48 GHashTable *icon_cache; | |
49 | |
50 icon = g_new0(GaimBuddyIcon, 1); | |
51 | |
52 gaim_buddy_icon_set_account(icon, account); | |
53 gaim_buddy_icon_set_username(icon, username); | |
54 | |
55 icon_cache = g_hash_table_lookup(account_cache, account); | |
56 | |
57 if (icon_cache == NULL) | |
58 { | |
59 icon_cache = g_hash_table_new(g_str_hash, g_str_equal); | |
60 | |
61 g_hash_table_insert(account_cache, account, icon_cache); | |
62 } | |
63 | |
64 g_hash_table_insert(icon_cache, | |
65 (char *)gaim_buddy_icon_get_username(icon), icon); | |
66 } | |
67 | |
68 gaim_buddy_icon_set_data(icon, icon_data, icon_len); | |
69 | |
70 gaim_buddy_icon_ref(icon); | |
71 | |
72 return icon; | |
73 } | |
74 | |
75 void | |
76 gaim_buddy_icon_destroy(GaimBuddyIcon *icon) | |
77 { | |
78 GHashTable *icon_cache; | |
79 | |
80 g_return_if_fail(icon != NULL); | |
81 | |
82 if (icon->ref_count > 0) | |
83 { | |
84 gaim_buddy_icon_unref(icon); | |
85 | |
86 return; | |
87 } | |
88 | |
89 icon_cache = g_hash_table_lookup(account_cache, | |
90 gaim_buddy_icon_get_account(icon)); | |
91 | |
92 if (icon_cache != NULL) | |
93 g_hash_table_remove(icon_cache, gaim_buddy_icon_get_username(icon)); | |
94 | |
95 if (icon->username != NULL) | |
96 g_free(icon->username); | |
97 | |
98 if (icon->data != NULL) | |
99 g_free(icon->data); | |
100 | |
101 g_free(icon); | |
102 } | |
103 | |
104 GaimBuddyIcon * | |
105 gaim_buddy_icon_ref(GaimBuddyIcon *icon) | |
106 { | |
107 g_return_val_if_fail(icon != NULL, NULL); | |
108 | |
109 icon->ref_count++; | |
110 | |
111 return icon; | |
112 } | |
113 | |
114 GaimBuddyIcon * | |
115 gaim_buddy_icon_unref(GaimBuddyIcon *icon) | |
116 { | |
117 g_return_val_if_fail(icon != NULL, NULL); | |
118 | |
119 if (icon->ref_count <= 0) | |
120 return NULL; | |
121 | |
122 icon->ref_count--; | |
123 | |
124 if (icon->ref_count == 0) | |
125 { | |
126 gaim_buddy_icon_destroy(icon); | |
127 | |
128 return NULL; | |
129 } | |
130 | |
131 return icon; | |
132 } | |
133 | |
134 void | |
135 gaim_buddy_icon_update(GaimBuddyIcon *icon) | |
136 { | |
137 GaimConversation *conv; | |
138 GaimAccount *account; | |
139 const char *username; | |
140 GSList *sl; | |
141 | |
142 g_return_if_fail(icon != NULL); | |
143 | |
144 account = gaim_buddy_icon_get_account(icon); | |
145 username = gaim_buddy_icon_get_username(icon); | |
146 | |
147 for (sl = gaim_find_buddies(account, username); sl != NULL; sl = sl->next) | |
148 { | |
149 GaimBuddy *buddy = (GaimBuddy *)sl->data; | |
150 | |
151 gaim_buddy_set_icon(buddy, icon); | |
152 } | |
153 | |
154 conv = gaim_find_conversation_with_account(username, account); | |
155 | |
156 if (conv != NULL && gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
6886
diff
changeset
|
157 gaim_conv_im_set_icon(GAIM_CONV_IM(conv), icon); |
6846 | 158 } |
159 | |
160 void | |
6886
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
161 gaim_buddy_icon_cache(GaimBuddyIcon *icon, GaimBuddy *buddy) |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
162 { |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
163 const void *data; |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
164 const char *dirname; |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
165 char *random; |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
166 char *filename; |
7125 | 167 const char *old_icon; |
6886
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
168 size_t len; |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
169 FILE *file = NULL; |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
170 |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
171 g_return_if_fail(icon != NULL); |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
172 g_return_if_fail(buddy != NULL); |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
173 |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
174 if (!gaim_buddy_icons_is_caching()) |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
175 return; |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
176 |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
177 data = gaim_buddy_icon_get_data(icon, &len); |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
178 |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
179 random = g_strdup_printf("%x", g_random_int()); |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
180 dirname = gaim_buddy_icons_get_cache_dir(); |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
181 filename = g_build_filename(dirname, random, NULL); |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
182 old_icon = gaim_buddy_get_setting(buddy, "buddy_icon"); |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
183 |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
184 g_free(random); |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
185 |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
186 if (!g_file_test(dirname, G_FILE_TEST_IS_DIR)) |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
187 { |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
188 gaim_debug_info("buddy icons", "Creating icon cache directory.\n"); |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
189 |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
190 if (mkdir(dirname, S_IRUSR | S_IWUSR | S_IXUSR) < 0) |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
191 { |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
192 gaim_debug_error("buddy icons", |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
193 "Unable to create directory %s: %s\n", |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
194 dirname, strerror(errno)); |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
195 } |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
196 } |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
197 |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
198 if ((file = fopen(filename, "wb")) != NULL) |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
199 { |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
200 fwrite(data, 1, len, file); |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
201 fclose(file); |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
202 } |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
203 |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
204 if (old_icon != NULL) |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
205 unlink(old_icon); |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
206 |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
207 gaim_buddy_set_setting(buddy, "buddy_icon", filename); |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
208 gaim_blist_save(); |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
209 |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
210 g_free(filename); |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
211 } |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
212 |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
213 void |
6846 | 214 gaim_buddy_icon_set_account(GaimBuddyIcon *icon, GaimAccount *account) |
215 { | |
216 g_return_if_fail(icon != NULL); | |
217 g_return_if_fail(account != NULL); | |
218 | |
219 icon->account = account; | |
220 } | |
221 | |
222 void | |
223 gaim_buddy_icon_set_username(GaimBuddyIcon *icon, const char *username) | |
224 { | |
225 g_return_if_fail(icon != NULL); | |
226 g_return_if_fail(username != NULL); | |
227 | |
228 if (icon->username != NULL) | |
229 g_free(icon->username); | |
230 | |
231 icon->username = g_strdup(username); | |
232 } | |
233 | |
234 void | |
235 gaim_buddy_icon_set_data(GaimBuddyIcon *icon, void *data, size_t len) | |
236 { | |
237 g_return_if_fail(icon != NULL); | |
238 | |
239 if (icon->data != NULL) | |
240 g_free(icon->data); | |
241 | |
242 if (data != NULL && len > 0) | |
243 { | |
244 icon->data = g_memdup(data, len); | |
245 icon->len = len; | |
246 } | |
247 else | |
248 { | |
249 icon->data = NULL; | |
250 icon->len = 0; | |
251 } | |
252 | |
253 gaim_buddy_icon_update(icon); | |
254 } | |
255 | |
256 GaimAccount * | |
257 gaim_buddy_icon_get_account(const GaimBuddyIcon *icon) | |
258 { | |
259 g_return_val_if_fail(icon != NULL, NULL); | |
260 | |
261 return icon->account; | |
262 } | |
263 | |
264 const char * | |
265 gaim_buddy_icon_get_username(const GaimBuddyIcon *icon) | |
266 { | |
267 g_return_val_if_fail(icon != NULL, NULL); | |
268 | |
269 return icon->username; | |
270 } | |
271 | |
272 const void * | |
273 gaim_buddy_icon_get_data(const GaimBuddyIcon *icon, size_t *len) | |
274 { | |
275 g_return_val_if_fail(icon != NULL, NULL); | |
276 | |
277 if (len != NULL) | |
278 *len = icon->len; | |
279 | |
280 return icon->data; | |
281 } | |
282 | |
283 void | |
284 gaim_buddy_icons_set_for_user(GaimAccount *account, const char *username, | |
285 void *icon_data, size_t icon_len) | |
286 { | |
287 g_return_if_fail(account != NULL); | |
288 g_return_if_fail(username != NULL); | |
289 | |
290 gaim_buddy_icon_new(account, username, icon_data, icon_len); | |
291 } | |
292 | |
293 GaimBuddyIcon * | |
294 gaim_buddy_icons_find(const GaimAccount *account, const char *username) | |
295 { | |
296 GHashTable *icon_cache; | |
297 | |
298 g_return_val_if_fail(account != NULL, NULL); | |
299 g_return_val_if_fail(username != NULL, NULL); | |
300 | |
301 icon_cache = g_hash_table_lookup(account_cache, account); | |
302 | |
303 if (icon_cache == NULL) | |
304 return NULL; | |
305 | |
306 return g_hash_table_lookup(icon_cache, username); | |
307 } | |
308 | |
6886
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
309 void |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
310 gaim_buddy_icons_set_caching(gboolean caching) |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
311 { |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
312 icon_caching = caching; |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
313 } |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
314 |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
315 gboolean |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
316 gaim_buddy_icons_is_caching(void) |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
317 { |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
318 return icon_caching; |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
319 } |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
320 |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
321 void |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
322 gaim_buddy_icons_set_cache_dir(const char *dir) |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
323 { |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
324 g_return_if_fail(cache_dir != NULL); |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
325 |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
326 if (cache_dir != NULL) |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
327 g_free(cache_dir); |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
328 |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
329 cache_dir = g_strdup(dir); |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
330 } |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
331 |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
332 const char * |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
333 gaim_buddy_icons_get_cache_dir(void) |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
334 { |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
335 return cache_dir; |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
336 } |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
337 |
6846 | 338 void * |
339 gaim_buddy_icons_get_handle() | |
340 { | |
341 static int handle; | |
342 | |
343 return &handle; | |
344 } | |
345 | |
346 void | |
347 gaim_buddy_icons_init() | |
348 { | |
349 account_cache = g_hash_table_new_full( | |
350 g_direct_hash, g_direct_equal, | |
351 NULL, (GFreeFunc)g_hash_table_destroy); | |
6886
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
352 |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
353 cache_dir = g_build_filename(gaim_user_dir(), "icons", NULL); |
6846 | 354 } |
355 | |
356 void | |
357 gaim_buddy_icons_uninit() | |
358 { | |
359 g_hash_table_destroy(account_cache); | |
360 } |