changeset 27841:0e516784bbae

merge of '05d22685de7c7e91a18724eccf5ecf6791146239' and '3ca58814bdd8642da208ea36f34f9a752fd4bf1b'
author Paul Aurich <paul@darkrain42.org>
date Thu, 06 Aug 2009 03:23:05 +0000
parents d9aef5487af9 (current diff) 0c90b164a735 (diff)
children f9cf1e14838b
files
diffstat 1 files changed, 18 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/buddy.c	Thu Aug 06 01:28:34 2009 +0000
+++ b/libpurple/protocols/jabber/buddy.c	Thu Aug 06 03:23:05 2009 +0000
@@ -1193,6 +1193,22 @@
 	g_free(jbri);
 }
 
+static guint jbir_hash(gconstpointer v)
+{
+	if (v)
+		return g_str_hash(v);
+	else
+		return 0;
+}
+
+static gboolean jbir_equal(gconstpointer v1, gconstpointer v2)
+{
+	const gchar *resource_1 = v1;
+	const gchar *resource_2 = v2;
+
+	return purple_strequal(resource_1, resource_2);
+}
+
 static void jabber_version_parse(JabberStream *js, const char *from,
                                  JabberIqType type, const char *id,
                                  xmlnode *packet, gpointer data)
@@ -1464,9 +1480,7 @@
 	char *full_jid = NULL;
 	const char *to;
 
-	g_return_if_fail(jbr->name != NULL);
-
-	if (is_bare_jid) {
+	if (is_bare_jid && jbr->name) {
 		full_jid = g_strdup_printf("%s/%s", jid, jbr->name);
 		to = full_jid;
 	} else
@@ -1535,7 +1549,7 @@
 	jbi->jid = g_strdup(jid);
 	jbi->js = js;
 	jbi->jb = jb;
-	jbi->resources = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, jabber_buddy_info_resource_free);
+	jbi->resources = g_hash_table_new_full(jbir_hash, jbir_equal, g_free, jabber_buddy_info_resource_free);
 	jbi->user_info = purple_notify_user_info_new();
 
 	iq = jabber_iq_new(js, JABBER_IQ_GET);