# HG changeset patch # User Mark Doliner # Date 1302654149 0 # Node ID fa183182bc2be022731fd9ef6b4d4106f17e9bfa # Parent 515ed916e691b4874e599b64c9f67d07217ab11f Update js->initial_avatar_hash if the user tries to set the icon before we've received our self vcard. This is the other half of a fix to get rid of a race condition where the user's icon wouldn't get set correctly if they set it while connecting. diff -r 515ed916e691 -r fa183182bc2b libpurple/protocols/jabber/buddy.c --- a/libpurple/protocols/jabber/buddy.c Wed Apr 13 00:17:13 2011 +0000 +++ b/libpurple/protocols/jabber/buddy.c Wed Apr 13 00:22:29 2011 +0000 @@ -467,8 +467,20 @@ /* if we haven't grabbed the remote vcard yet, we can't * assume that what we have here is correct */ - if(!js->vcard_fetched) + if(!js->vcard_fetched) { + PurpleStoredImage *image; + g_free(js->initial_avatar_hash); + image = purple_buddy_icons_find_account_icon(purple_connection_get_account(gc)); + if (image != NULL) { + js->initial_avatar_hash = + jabber_calculate_data_hash(purple_imgstore_get_data(image), + purple_imgstore_get_size(image), "sha1"); + purple_imgstore_unref(image); + } else { + js->initial_avatar_hash = NULL; + } return; + } if (js->vcard_timer) { purple_timeout_remove(js->vcard_timer);