diff libpurple/protocols/jabber/chat.c @ 23159:25161f5ea347

propagate from branch 'im.pidgin.pidgin' (head 4f00ea617df3c000b6eb237b4139b89e5d8170a3) to branch 'im.pidgin.pidgin.next.minor' (head c2457daceab155be8fb8b11753c4e767c2c1a83c)
author Evan Schoenberg <evan.s@dreskin.net>
date Wed, 21 May 2008 02:09:00 +0000
parents 1003f1736be1 53bf3c21b79d
children 5793bcea224c
line wrap: on
line diff
--- a/libpurple/protocols/jabber/chat.c	Wed May 21 01:59:38 2008 +0000
+++ b/libpurple/protocols/jabber/chat.c	Wed May 21 02:09:00 2008 +0000
@@ -197,6 +197,12 @@
 	return chat_name;
 }
 
+static void insert_in_hash_table(gpointer key, gpointer value, gpointer user_data)
+{
+	GHashTable *hash_table = (GHashTable *)user_data;
+	g_hash_table_insert(hash_table, g_strdup(key), g_strdup(value));
+}
+
 void jabber_chat_join(PurpleConnection *gc, GHashTable *data)
 {
 	JabberChat *chat;
@@ -225,18 +231,21 @@
 		char *buf = g_strdup_printf(_("%s is not a valid room name"), room);
 		purple_notify_error(gc, _("Invalid Room Name"), _("Invalid Room Name"),
 				buf);
+		purple_serv_got_join_chat_failed(gc, data);
 		g_free(buf);
 		return;
 	} else if(!jabber_nameprep_validate(server)) {
 		char *buf = g_strdup_printf(_("%s is not a valid server name"), server);
 		purple_notify_error(gc, _("Invalid Server Name"),
 				_("Invalid Server Name"), buf);
+		purple_serv_got_join_chat_failed(gc, data);
 		g_free(buf);
 		return;
 	} else if(!jabber_resourceprep_validate(handle)) {
 		char *buf = g_strdup_printf(_("%s is not a valid room handle"), handle);
 		purple_notify_error(gc, _("Invalid Room Handle"),
 				_("Invalid Room Handle"), buf);
+		purple_serv_got_join_chat_failed(gc, data);
 		g_free(buf);
 		return;
 	}
@@ -255,6 +264,11 @@
 	chat->server = g_strdup(server);
 	chat->handle = g_strdup(handle);
 
+	/* Copy the data hash table to chat->components */
+	chat->components = g_hash_table_new_full(g_str_hash, g_str_equal,
+			g_free, g_free);
+	g_hash_table_foreach(data, insert_in_hash_table, chat->components);
+
 	chat->members = g_hash_table_new_full(g_str_hash, g_str_equal, NULL,
 			(GDestroyNotify)jabber_chat_member_free);
 
@@ -315,6 +329,7 @@
 	g_free(chat->server);
 	g_free(chat->handle);
 	g_hash_table_destroy(chat->members);
+	g_hash_table_destroy(chat->components);
 	g_free(chat);
 }