comparison libpurple/protocols/jabber/buddy.c @ 24915:1e121a3eceeb

Allow us to remove vCard avatars when the PurpleAccount doesn't have one specified. Closes #7974 committer: Etan Reisner <pidgin@unreliablesource.net>
author Paul Aurich <paul@darkrain42.org>
date Wed, 07 Jan 2009 04:39:28 +0000
parents c07b0aa88a35
children ca4ccf646993 e33aee62e537
comparison
equal deleted inserted replaced
24914:c07b0aa88a35 24915:1e121a3eceeb
457 xmlnode_set_attrib(vc_node, tag_attr->attr, tag_attr->value); 457 xmlnode_set_attrib(vc_node, tag_attr->attr, tag_attr->value);
458 } 458 }
459 459
460 avatar_data = purple_imgstore_get_data(img); 460 avatar_data = purple_imgstore_get_data(img);
461 avatar_len = purple_imgstore_get_size(img); 461 avatar_len = purple_imgstore_get_size(img);
462 /* have to get rid of the old PHOTO if it exists */ 462 /* Get rid of an old PHOTO if one exists.
463 * TODO: This may want to be modified to remove all old PHOTO
464 * children, at the moment some people have managed to get
465 * multiple PHOTO entries in their vCard. */
463 if((photo = xmlnode_get_child(vc_node, "PHOTO"))) { 466 if((photo = xmlnode_get_child(vc_node, "PHOTO"))) {
464 xmlnode_free(photo); 467 xmlnode_free(photo);
465 } 468 }
466 photo = xmlnode_new_child(vc_node, "PHOTO"); 469 photo = xmlnode_new_child(vc_node, "PHOTO");
467 type = xmlnode_new_child(photo, "TYPE"); 470 type = xmlnode_new_child(photo, "TYPE");
471 474
472 js->avatar_hash = jabber_calculate_data_sha1sum(avatar_data, avatar_len); 475 js->avatar_hash = jabber_calculate_data_sha1sum(avatar_data, avatar_len);
473 476
474 xmlnode_insert_data(binval, enc, -1); 477 xmlnode_insert_data(binval, enc, -1);
475 g_free(enc); 478 g_free(enc);
479 } else if (vc_node) {
480 xmlnode *photo;
481 /* TODO: Remove all PHOTO children? (see above note) */
482 if ((photo = xmlnode_get_child(vc_node, "PHOTO"))) {
483 xmlnode_free(photo);
484 }
476 } 485 }
477 486
478 if (vc_node != NULL) { 487 if (vc_node != NULL) {
479 iq = jabber_iq_new(js, JABBER_IQ_SET); 488 iq = jabber_iq_new(js, JABBER_IQ_SET);
480 xmlnode_insert_child(iq->node, vc_node); 489 xmlnode_insert_child(iq->node, vc_node);