Mercurial > pidgin.yaz
changeset 14067:f3ed5f4efcae
[gaim-migrate @ 16688]
Fix for CID 110 (which also will fix some asserts that happen when you edit your Jabber User Info for the first time)
Fix for CID 251 (Null check after deref)
Fixes for CID 252, 253. (UNUSED_VALUE)
I also changed the jabber_buddy_find() call in jabber_vcard_parse not to create the JabberBuddy if it doesn't exist - there should be a specific jabber buddy attached to the JabberBuddyInfo and if isn't present any more, we shouldn't create a new one.
committer: Tailor Script <tailor@pidgin.im>
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Thu, 10 Aug 2006 21:08:00 +0000 |
parents | 29f03c8fba4a |
children | 6cb8bdc3366f |
files | src/protocols/jabber/buddy.c |
diffstat | 1 files changed, 20 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/src/protocols/jabber/buddy.c Thu Aug 10 18:18:17 2006 +0000 +++ b/src/protocols/jabber/buddy.c Thu Aug 10 21:08:00 2006 +0000 @@ -532,7 +532,7 @@ GaimRequestFieldGroup *group; GaimRequestField *field; const struct vcard_template *vc_tp; - char *user_info; + const char *user_info; char *cdata; xmlnode *x_vc_data = NULL; @@ -543,10 +543,8 @@ /* * Get existing, XML-formatted, user info */ - if((user_info = g_strdup(gaim_account_get_user_info(gc->account))) != NULL) + if((user_info = gaim_account_get_user_info(gc->account)) != NULL) x_vc_data = xmlnode_from_str(user_info, -1); - else - user_info = g_strdup(""); /* * Set up GSLists for edit with labels from "template," data from user info @@ -555,16 +553,20 @@ xmlnode *data_node; if((vc_tp->label)[0] == '\0') continue; - if(vc_tp->ptag == NULL) { - data_node = xmlnode_get_child(x_vc_data, vc_tp->tag); - } else { - gchar *tag = g_strdup_printf("%s/%s", vc_tp->ptag, vc_tp->tag); - data_node = xmlnode_get_child(x_vc_data, tag); - g_free(tag); - } - if(data_node) - cdata = xmlnode_get_data(data_node); - else + + if (x_vc_data != NULL) { + if(vc_tp->ptag == NULL) { + data_node = xmlnode_get_child(x_vc_data, vc_tp->tag); + } else { + gchar *tag = g_strdup_printf("%s/%s", vc_tp->ptag, vc_tp->tag); + data_node = xmlnode_get_child(x_vc_data, tag); + g_free(tag); + } + if(data_node) + cdata = xmlnode_get_data(data_node); + else + cdata = NULL; + } else cdata = NULL; if(strcmp(vc_tp->tag, "DESC") == 0) { @@ -583,8 +585,6 @@ if(x_vc_data != NULL) xmlnode_free(x_vc_data); - g_free(user_info); - gaim_request_fields(gc, _("Edit Jabber vCard"), _("Edit Jabber vCard"), _("All items below are optional. Enter only the " @@ -724,8 +724,7 @@ static void jabber_vcard_parse(JabberStream *js, xmlnode *packet, gpointer data) { - const char *type, *id, *from; - JabberBuddy *jb; + const char *id, *from; GString *info_text; char *bare_jid; char *text; @@ -734,18 +733,17 @@ JabberBuddyInfo *jbi = data; from = xmlnode_get_attrib(packet, "from"); - type = xmlnode_get_attrib(packet, "type"); id = xmlnode_get_attrib(packet, "id"); - jabber_buddy_info_remove_id(jbi, id); - if(!jbi) return; + jabber_buddy_info_remove_id(jbi, id); + if(!from) return; - if(!(jb = jabber_buddy_find(js, from, TRUE))) + if(!jabber_buddy_find(js, from, FALSE)) return; /* XXX: handle the error case */