diff src/protocols/jabber/chat.c @ 9770:41f302d41839

[gaim-migrate @ 10638] (22:52:45) noif: LSchiere: one last addition to my chat-info-defaults patch... this removes the old defaulting mechanism which only jabber used and accomplishes the same thing through the new defaulting mechanism. It also changes the "Group" to "Room" for oscar chats to avoid having two fields labelled "Group". committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Tue, 17 Aug 2004 02:52:13 +0000
parents 3f97624e7753
children 0056843d512c
line wrap: on
line diff
--- a/src/protocols/jabber/chat.c	Tue Aug 17 00:50:20 2004 +0000
+++ b/src/protocols/jabber/chat.c	Tue Aug 17 02:52:13 2004 +0000
@@ -36,7 +36,6 @@
 {
 	GList *m = NULL;
 	struct proto_chat_entry *pce;
-	JabberStream *js = gc->proto_data;
 
 	pce = g_new0(struct proto_chat_entry, 1);
 	pce->label = _("_Room:");
@@ -46,13 +45,11 @@
 	pce = g_new0(struct proto_chat_entry, 1);
 	pce->label = _("_Server:");
 	pce->identifier = "server";
-	pce->def = js->chat_servers ? js->chat_servers->data : "conference.jabber.org";
 	m = g_list_append(m, pce);
 
 	pce = g_new0(struct proto_chat_entry, 1);
 	pce->label = _("_Handle:");
 	pce->identifier = "handle";
-	pce->def = js->user->node;
 	m = g_list_append(m, pce);
 
 	pce = g_new0(struct proto_chat_entry, 1);
@@ -67,15 +64,23 @@
 GHashTable *jabber_chat_info_defaults(GaimConnection *gc, const char *chat_name)
 {
 	GHashTable *defaults;
+	JabberStream *js = gc->proto_data;
 
 	defaults = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free);
 
+	g_hash_table_insert(defaults, "handle", g_strdup(js->user->node));
+
+	if (js->chat_servers)
+		g_hash_table_insert(defaults, "server", g_strdup(js->chat_servers->data));
+	else
+		g_hash_table_insert(defaults, "server", g_strdup("conference.jabber.org"));
+
 	if (chat_name != NULL) {
 		JabberID *jid = jabber_id_new(chat_name);
 		if(jid) {
 			g_hash_table_insert(defaults, "room", g_strdup(jid->node));
 			if(jid->domain)
-				g_hash_table_insert(defaults, "server", g_strdup(jid->domain));
+				g_hash_table_replace(defaults, "server", g_strdup(jid->domain));
 			jabber_id_free(jid);
 		}
 	}