comparison libpurple/protocols/myspace/myspace.c @ 19351:5461821ac122

g_memdup() the icon data before setting it as the buddy icon. Closes #2725.
author Jeffrey Connelly <jaconnel@calpoly.edu>
date Thu, 23 Aug 2007 06:02:54 +0000
parents 8839775bad3e
children 93f01e37d9f1
comparison
equal deleted inserted replaced
19350:8839775bad3e 19351:5461821ac122
1782 g_free(username); 1782 g_free(username);
1783 1783
1784 return rc; 1784 return rc;
1785 } 1785 }
1786 1786
1787 /* Process an incoming media (buddy icon) message. */ 1787 /* Process an incoming media (message background?) message. */
1788 static gboolean 1788 static gboolean
1789 msim_incoming_media(MsimSession *session, MsimMessage *msg) 1789 msim_incoming_media(MsimSession *session, MsimMessage *msg)
1790 { 1790 {
1791 gchar *username, *text; 1791 gchar *username, *text;
1792 1792
2654 user = (MsimUser *)user_data; 2654 user = (MsimUser *)user_data;
2655 2655
2656 purple_debug_info("msim_downloaded_buddy_icon", 2656 purple_debug_info("msim_downloaded_buddy_icon",
2657 "Downloaded %d bytes\n", len); 2657 "Downloaded %d bytes\n", len);
2658 2658
2659 if (!url_text) {
2660 purple_debug_info("msim_downloaded_buddy_icon",
2661 "failed to download icon for %s",
2662 user->buddy->name);
2663 return;
2664 }
2665
2659 purple_buddy_icons_set_for_user(user->buddy->account, 2666 purple_buddy_icons_set_for_user(user->buddy->account,
2660 user->buddy->name, 2667 user->buddy->name,
2661 (gchar *)url_text, len, 2668 g_memdup((gchar *)url_text, len), len,
2662 /* Use URL itself as buddy icon "checksum" */ 2669 /* Use URL itself as buddy icon "checksum" (TODO: ETag) */
2663 user->image_url); 2670 user->image_url); /* checksum */
2664 } 2671 }
2665 2672
2666 /** Store a field of information about a buddy. */ 2673 /** Store a field of information about a buddy. */
2667 static void 2674 static void
2668 msim_store_user_info_each(const gchar *key_str, gchar *value_str, MsimUser *user) 2675 msim_store_user_info_each(const gchar *key_str, gchar *value_str, MsimUser *user)