Mercurial > pidgin.yaz
changeset 16621:dbd0a01a9a81
The OSCAR timestamp stuff.
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Sun, 29 Apr 2007 01:04:19 +0000 |
parents | e9c412816e4e |
children | 8d8168fada21 |
files | libpurple/buddyicon.c libpurple/buddyicon.h libpurple/protocols/oscar/oscar.c |
diffstat | 3 files changed, 37 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/buddyicon.c Sun Apr 29 01:01:51 2007 +0000 +++ b/libpurple/buddyicon.c Sun Apr 29 01:04:19 2007 +0000 @@ -694,11 +694,13 @@ { const char *filename = purple_imgstore_get_filename(img); purple_account_set_string(account, "buddy_icon", filename); + purple_account_set_int(account, "buddy_icon_timestamp", time(NULL)); ref_filename(filename); } else { purple_account_set_string(account, "buddy_icon", NULL); + purple_account_set_int(account, "buddy_icon_timestamp", 0); } unref_filename(old_icon); @@ -733,6 +735,25 @@ return img; } +time_t +purple_buddy_icons_get_account_icon_timestamp(PurpleAccount *account) +{ + time_t ret; + + g_return_val_if_fail(account != NULL, 0); + + ret = purple_account_get_int(account, "buddy_icon_timestamp", 0); + + /* This deals with migration cases. */ + if (ret == 0 && purple_account_get_string(account, "buddy_icon", NULL) != NULL) + { + ret = time(NULL); + purple_account_set_int(account, "buddy_icon_timestamp", ret); + } + + return ret; +} + PurpleStoredImage * purple_buddy_icons_find_custom_icon(PurpleContact *contact) {
--- a/libpurple/buddyicon.h Sun Apr 29 01:01:51 2007 +0000 +++ b/libpurple/buddyicon.h Sun Apr 29 01:04:19 2007 +0000 @@ -261,6 +261,19 @@ guchar *icon_data, size_t icon_len); /** + * Returns the timestamp of when the icon was set. + * + * This is intended for use in protocols that require a timestamp for + * buddy icon update reasons. + * + * @param account The account + * + * @return The time the icon was set, or 0 if an error occurred. + */ +time_t +purple_buddy_icons_get_account_icon_timestamp(PurpleAccount *account); + +/** * Returns the custom buddy icon image for a contact. * * The caller owns a reference to the image in the store, and must dereference
--- a/libpurple/protocols/oscar/oscar.c Sun Apr 29 01:01:51 2007 +0000 +++ b/libpurple/protocols/oscar/oscar.c Sun Apr 29 01:04:19 2007 +0000 @@ -1941,9 +1941,9 @@ purple_debug_info("oscar", "Sending buddy icon to %s (%d bytes)\n", userinfo->sn, len); - /* TODO: XXX: FIXME: Does this actually need the mtime of the file? */ aim_im_sendch2_icon(od, userinfo->sn, data, len, - time(NULL), aimutil_iconsum(data, len)); + purple_buddy_icons_get_account_icon_timestamp(account), + aimutil_iconsum(data, len)); } purple_imgstore_unref(img); @@ -4232,8 +4232,7 @@ gconstpointer data = purple_imgstore_get_data(img); args.iconlen = purple_imgstore_get_size(img); args.iconsum = aimutil_iconsum(data, args.iconlen); - /* TODO: XXX: FIXME: Deal with the timestamp issue. */ - args.iconstamp = time(NULL); + args.iconstamp = purple_buddy_icons_get_account_icon_timestamp(account); if ((args.iconlen != bi->ico_me_len) || (args.iconsum != bi->ico_me_csum) || (args.iconstamp != bi->ico_me_time)) { bi->ico_informed = FALSE;