| 1434 char *who; |
1434 char *who; |
| 1435 } _DndData; |
1435 } _DndData; |
| 1436 |
1436 |
| 1437 static void dnd_image_ok_callback(_DndData *data, int choice) |
1437 static void dnd_image_ok_callback(_DndData *data, int choice) |
| 1438 { |
1438 { |
| 1439 char *filedata; |
1439 gchar *filedata; |
| 1440 size_t size; |
1440 size_t size; |
| 1441 struct stat st; |
1441 struct stat st; |
| 1442 GError *err = NULL; |
1442 GError *err = NULL; |
| 1443 PurpleConversation *conv; |
1443 PurpleConversation *conv; |
| 1444 PidginConversation *gtkconv; |
1444 PidginConversation *gtkconv; |
| 1445 GtkTextIter iter; |
1445 GtkTextIter iter; |
| 1446 int id; |
1446 int id; |
| |
1447 PurpleBuddy *buddy; |
| |
1448 PurpleContact *contact; |
| 1447 switch (choice) { |
1449 switch (choice) { |
| 1448 case DND_BUDDY_ICON: |
1450 case DND_BUDDY_ICON: |
| 1449 if (g_stat(data->filename, &st)) { |
1451 if (g_stat(data->filename, &st)) { |
| 1450 char *str; |
1452 char *str; |
| 1451 |
1453 |
| 1457 g_free(str); |
1459 g_free(str); |
| 1458 |
1460 |
| 1459 return; |
1461 return; |
| 1460 } |
1462 } |
| 1461 |
1463 |
| 1462 pidgin_set_custom_buddy_icon(data->account, data->who, data->filename); |
1464 buddy = purple_find_buddy(data->account, data->who); |
| |
1465 if (!buddy) { |
| |
1466 purple_debug_info("custom-icon", "You can only set custom icons for people on your buddylist.\n"); |
| |
1467 break; |
| |
1468 } |
| |
1469 contact = purple_buddy_get_contact(buddy); |
| |
1470 purple_buddy_icons_node_set_custom_icon_from_file((PurpleBlistNode*)contact, data->filename); |
| 1463 break; |
1471 break; |
| 1464 case DND_FILE_TRANSFER: |
1472 case DND_FILE_TRANSFER: |
| 1465 serv_send_file(purple_account_get_connection(data->account), data->who, data->filename); |
1473 serv_send_file(purple_account_get_connection(data->account), data->who, data->filename); |
| 1466 break; |
1474 break; |
| 1467 case DND_IM_IMAGE: |
1475 case DND_IM_IMAGE: |
| 2867 |
2875 |
| 2868 return pixbuf; |
2876 return pixbuf; |
| 2869 } |
2877 } |
| 2870 #endif /* ! Gtk 2.6.0 */ |
2878 #endif /* ! Gtk 2.6.0 */ |
| 2871 |
2879 |
| |
2880 #ifndef PURPLE_DISABLE_DEPRECATED |
| 2872 void pidgin_set_custom_buddy_icon(PurpleAccount *account, const char *who, const char *filename) |
2881 void pidgin_set_custom_buddy_icon(PurpleAccount *account, const char *who, const char *filename) |
| 2873 { |
2882 { |
| 2874 PurpleBuddy *buddy; |
2883 PurpleBuddy *buddy; |
| 2875 PurpleContact *contact; |
2884 PurpleContact *contact; |
| 2876 gpointer data = NULL; |
|
| 2877 size_t len = 0; |
|
| 2878 |
2885 |
| 2879 buddy = purple_find_buddy(account, who); |
2886 buddy = purple_find_buddy(account, who); |
| 2880 if (!buddy) { |
2887 if (!buddy) { |
| 2881 purple_debug_info("custom-icon", "You can only set custom icon for someone in your buddylist.\n"); |
2888 purple_debug_info("custom-icon", "You can only set custom icon for someone in your buddylist.\n"); |
| 2882 return; |
2889 return; |
| 2883 } |
2890 } |
| 2884 |
2891 |
| 2885 contact = purple_buddy_get_contact(buddy); |
2892 contact = purple_buddy_get_contact(buddy); |
| 2886 |
2893 purple_buddy_icons_node_set_custom_icon_from_file((PurpleBlistNode*)contact, filename); |
| 2887 if (filename) { |
2894 } |
| 2888 const char *prpl_id = purple_account_get_protocol_id(account); |
2895 #endif |
| 2889 PurplePlugin *prpl = purple_find_prpl(prpl_id); |
|
| 2890 |
|
| 2891 data = pidgin_convert_buddy_icon(prpl, filename, &len); |
|
| 2892 |
|
| 2893 /* We don't want to delete the old icon if the new one didn't load. */ |
|
| 2894 if (data == NULL) |
|
| 2895 return; |
|
| 2896 } |
|
| 2897 |
|
| 2898 purple_buddy_icons_set_custom_icon(contact, data, len); |
|
| 2899 } |
|
| 2900 |
2896 |
| 2901 char *pidgin_make_pretty_arrows(const char *str) |
2897 char *pidgin_make_pretty_arrows(const char *str) |
| 2902 { |
2898 { |
| 2903 char *ret; |
2899 char *ret; |
| 2904 char **split = g_strsplit(str, "->", -1); |
2900 char **split = g_strsplit(str, "->", -1); |