diff libpurple/protocols/jabber/chat.c @ 23103:591ef3693345

As discussed on the devel list, purple_serv_got_join_chat_failed() and the "chat-join-failed" signal now accept and pass (respectively) a GHashTable instead of a string. The GHashTable is the same one which was passed to serv_join_chat() originally.
author Evan Schoenberg <evan.s@dreskin.net>
date Wed, 30 Apr 2008 06:29:16 +0000
parents 43233dc1d40b
children 568a0957e835
line wrap: on
line diff
--- a/libpurple/protocols/jabber/chat.c	Wed Apr 30 05:56:53 2008 +0000
+++ b/libpurple/protocols/jabber/chat.c	Wed Apr 30 06:29:16 2008 +0000
@@ -222,39 +222,36 @@
 	if(!handle)
 		handle = js->user->node;
 
-	tmp = g_strdup_printf("%s@%s", room, server);
-	room_jid = g_strdup(jabber_normalize(NULL, tmp));
-	g_free(tmp);
-
 	if(!jabber_nodeprep_validate(room)) {
 		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, room_jid);
-		g_free(room_jid);
+		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, room_jid);
-		g_free(room_jid);
+		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, room_jid);
+		purple_serv_got_join_chat_failed(gc, data);
 		g_free(buf);
-		g_free(room_jid);
 		return;
 	}
 
 	if(jabber_chat_find(js, room, server))
 		return;
 
+	tmp = g_strdup_printf("%s@%s", room, server);
+	room_jid = g_strdup(jabber_normalize(NULL, tmp));
+	g_free(tmp);
+
 	chat = g_new0(JabberChat, 1);
 	chat->js = gc->proto_data;
 
@@ -262,6 +259,8 @@
 	chat->server = g_strdup(server);
 	chat->handle = g_strdup(handle);
 
+	chat->components = g_hash_table_ref(data);
+										
 	chat->members = g_hash_table_new_full(g_str_hash, g_str_equal, NULL,
 			(GDestroyNotify)jabber_chat_member_free);
 
@@ -322,6 +321,7 @@
 	g_free(chat->server);
 	g_free(chat->handle);
 	g_hash_table_destroy(chat->members);
+	g_hash_table_unref(chat->components);
 	g_free(chat);
 }