| 264 do_save_icon(GtkObject *obj, GaimConversation *c) |
264 do_save_icon(GtkObject *obj, GaimConversation *c) |
| 265 { |
265 { |
| 266 GaimGtkConversation *gtkconv; |
266 GaimGtkConversation *gtkconv; |
| 267 FILE *file; |
267 FILE *file; |
| 268 const char *f; |
268 const char *f; |
| 269 |
269 |
| 270 gtkconv = GAIM_GTK_CONVERSATION(c); |
270 gtkconv = GAIM_GTK_CONVERSATION(c); |
| 271 |
271 |
| 272 f = gtk_file_selection_get_filename( |
272 f = gtk_file_selection_get_filename( |
| 273 GTK_FILE_SELECTION(gtkconv->u.im->save_icon)); |
273 GTK_FILE_SELECTION(gtkconv->u.im->save_icon)); |
| 274 |
274 |
| 275 if (gaim_gtk_check_if_dir(f, GTK_FILE_SELECTION(gtkconv->u.im->save_icon))) |
275 if (gaim_gtk_check_if_dir(f, GTK_FILE_SELECTION(gtkconv->u.im->save_icon))) |
| 276 return; |
276 return; |
| 277 |
277 |
| 278 if ((file = fopen(f, "w")) != NULL) { |
278 if ((file = fopen(f, "w")) != NULL) { |
| 279 int len; |
279 GaimBuddyIcon *icon = gaim_im_get_icon(GAIM_IM(c)); |
| 280 void *data = get_icon_data(gaim_conversation_get_gc(c), |
280 size_t len; |
| 281 normalize(gaim_conversation_get_name(c)), |
281 const void *data = gaim_buddy_icon_get_data(icon, &len); |
| 282 &len); |
|
| 283 |
282 |
| 284 if (data) |
283 if (data) |
| 285 fwrite(data, 1, len, file); |
284 fwrite(data, 1, len, file); |
| 286 |
285 |
| 287 fclose(file); |
286 fclose(file); |