changeset 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 a63358a0093e
children eec0c7fd8529
files src/protocols/jabber/buddy.c
diffstat 1 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/jabber/buddy.c	Sun Aug 13 05:22:33 2006 +0000
+++ b/src/protocols/jabber/buddy.c	Sun Aug 13 05:50:19 2006 +0000
@@ -1119,15 +1119,20 @@
 	for(resources = jb->resources; resources; resources = resources->next)
 	{
 		JabberBuddyResource *jbr = resources->data;
-		JabberBuddyInfoResource *jbir = g_new0(JabberBuddyInfoResource, 1);
+		JabberBuddyInfoResource *jbir;
 		char *full_jid;
-		if(strrchr(jid, '/')) {
+
+		if ((strchr(jid, '/') == NULL) && (jbr->name != NULL)) {
+			full_jid = g_strdup_printf("%s/%s", jid, jbr->name);
+		} else {
 			full_jid = g_strdup(jid);
-		} else {
-			full_jid = g_strdup_printf("%s/%s", jid, jbr->name);
 		}
 
-		g_hash_table_insert(jbi->resources, g_strdup(jbr->name), jbir);
+		if (jbr->name != NULL)
+		{
+			jbir = g_new0(JabberBuddyInfoResource, 1);
+			g_hash_table_insert(jbi->resources, g_strdup(jbr->name), jbir);
+		}
 
 		if(!jbr->client.name) {
 			iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:version");