comparison src/protocols/jabber/buddy.c @ 14102:14e14f1ef1d8

[gaim-migrate @ 16732] Jabber crashed when getting info from someone on your buddy list if the JID consists only of the domain identifer. For example, add "quser.alpha.qunu.com" to your buddy list then get their info. This fixes the crashing. I'm not really sure if the fix is correct. Can someone familiar with Jabber please look over this? committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 13 Aug 2006 05:50:19 +0000
parents b9e9938b1afa
children
comparison
equal deleted inserted replaced
14101:a63358a0093e 14102:14e14f1ef1d8
1117 jabber_iq_send(iq); 1117 jabber_iq_send(iq);
1118 1118
1119 for(resources = jb->resources; resources; resources = resources->next) 1119 for(resources = jb->resources; resources; resources = resources->next)
1120 { 1120 {
1121 JabberBuddyResource *jbr = resources->data; 1121 JabberBuddyResource *jbr = resources->data;
1122 JabberBuddyInfoResource *jbir = g_new0(JabberBuddyInfoResource, 1); 1122 JabberBuddyInfoResource *jbir;
1123 char *full_jid; 1123 char *full_jid;
1124 if(strrchr(jid, '/')) { 1124
1125 if ((strchr(jid, '/') == NULL) && (jbr->name != NULL)) {
1126 full_jid = g_strdup_printf("%s/%s", jid, jbr->name);
1127 } else {
1125 full_jid = g_strdup(jid); 1128 full_jid = g_strdup(jid);
1126 } else { 1129 }
1127 full_jid = g_strdup_printf("%s/%s", jid, jbr->name); 1130
1128 } 1131 if (jbr->name != NULL)
1129 1132 {
1130 g_hash_table_insert(jbi->resources, g_strdup(jbr->name), jbir); 1133 jbir = g_new0(JabberBuddyInfoResource, 1);
1134 g_hash_table_insert(jbi->resources, g_strdup(jbr->name), jbir);
1135 }
1131 1136
1132 if(!jbr->client.name) { 1137 if(!jbr->client.name) {
1133 iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:version"); 1138 iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:version");
1134 xmlnode_set_attrib(iq->node, "to", full_jid); 1139 xmlnode_set_attrib(iq->node, "to", full_jid);
1135 jabber_iq_set_callback(iq, jabber_version_parse, jbi); 1140 jabber_iq_set_callback(iq, jabber_version_parse, jbi);