diff src/protocols/jabber/chat.c @ 9754:4a8bf81b82ae

[gaim-migrate @ 10621] " This will default the room/server fields to the proper values when an add chat is requested from a conversation window. It wasn't quite as trivial as the reporter suggested..." --Nathan (noif) Fredrickson committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Sun, 15 Aug 2004 19:34:20 +0000
parents db62420a53a2
children cee4e4cae56a
line wrap: on
line diff
--- a/src/protocols/jabber/chat.c	Sun Aug 15 17:05:51 2004 +0000
+++ b/src/protocols/jabber/chat.c	Sun Aug 15 19:34:20 2004 +0000
@@ -64,6 +64,24 @@
 	return m;
 }
 
+GHashTable *jabber_chat_info_defaults(GaimConnection *gc, const char *chat_name)
+{
+	GHashTable *defaults;
+	gchar **name_split;
+
+	defaults = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free);
+
+	if (chat_name != NULL) {
+		name_split = g_strsplit(chat_name, "@", 2);
+		g_hash_table_insert(defaults, "room", g_strdup(name_split[0]));
+		if (name_split[1] != NULL)
+			g_hash_table_insert(defaults, "server", g_strdup(name_split[1]));
+		g_strfreev(name_split);
+	}
+
+	return defaults;
+}
+
 JabberChat *jabber_chat_find(JabberStream *js, const char *room,
 		const char *server)
 {