Mercurial > pidgin
comparison libpurple/protocols/jabber/jabber.c @ 25426:2d92bbe6807b
Use a JabberStream variable instead of a setting for the initial hash
The hash is only used at login to compare with the PEP avatar(s) and vCard and
is recalculated at each login, so there's no need to store it as a setting.
The variable is eitehr NULL or the hash now, instead of "" or the hash.
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Sat, 14 Feb 2009 18:23:13 +0000 |
parents | ab07969d298f |
children | 7e020fbe2cdb |
comparison
equal
deleted
inserted
replaced
25425:0fa91206cf5a | 25426:2d92bbe6807b |
---|---|
737 PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, | 737 PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, |
738 _("Invalid XMPP ID. Domain must be set.")); | 738 _("Invalid XMPP ID. Domain must be set.")); |
739 return; | 739 return; |
740 } | 740 } |
741 | 741 |
742 /* This account setting is used to determine if we should re-sync our avatar to the | 742 /* |
743 * server at login. */ | 743 * Calculate the avatar hash for our current image so we know (when we |
744 * fetch our vCard and PEP avatar) if we should send our avatar to the | |
745 * server. | |
746 */ | |
744 if ((image = purple_buddy_icons_find_account_icon(account))) { | 747 if ((image = purple_buddy_icons_find_account_icon(account))) { |
745 char *checksum = jabber_calculate_data_sha1sum(purple_imgstore_get_data(image), | 748 js->initial_avatar_hash = jabber_calculate_data_sha1sum(purple_imgstore_get_data(image), |
746 purple_imgstore_get_size(image)); | 749 purple_imgstore_get_size(image)); |
747 purple_account_set_string(account, "prpl-jabber_icon_checksum", checksum); | |
748 g_free(checksum); | |
749 purple_imgstore_unref(image); | 750 purple_imgstore_unref(image); |
750 } else { | |
751 purple_account_set_string(account, "prpl-jabber_icon_checksum", ""); | |
752 } | 751 } |
753 | 752 |
754 if((my_jb = jabber_buddy_find(js, purple_account_get_username(account), TRUE))) | 753 if((my_jb = jabber_buddy_find(js, purple_account_get_username(account), TRUE))) |
755 my_jb->subscription |= JABBER_SUB_BOTH; | 754 my_jb->subscription |= JABBER_SUB_BOTH; |
756 | 755 |
1380 } | 1379 } |
1381 | 1380 |
1382 g_free(js->stream_id); | 1381 g_free(js->stream_id); |
1383 if(js->user) | 1382 if(js->user) |
1384 jabber_id_free(js->user); | 1383 jabber_id_free(js->user); |
1384 g_free(js->initial_avatar_hash); | |
1385 g_free(js->avatar_hash); | 1385 g_free(js->avatar_hash); |
1386 | 1386 |
1387 purple_circ_buffer_destroy(js->write_buffer); | 1387 purple_circ_buffer_destroy(js->write_buffer); |
1388 if(js->writeh) | 1388 if(js->writeh) |
1389 purple_input_remove(js->writeh); | 1389 purple_input_remove(js->writeh); |