changeset 23184:89713caa9ade

Try to get a hashtable created by the prpl first before joining a chat not in the buddylist. This gets rid of a runtime warning when trying to show the tooltip for a chat not in the buddylist (XMPP).
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sun, 25 May 2008 16:08:26 +0000
parents 41171963c986
children 013ec6fabd3f
files pidgin/gtkconv.c
diffstat 1 files changed, 12 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkconv.c	Sat May 24 23:03:20 2008 +0000
+++ b/pidgin/gtkconv.c	Sun May 25 16:08:26 2008 +0000
@@ -3153,10 +3153,18 @@
 
 		if ((chat == NULL) && (gtkconv->imhtml != NULL)) {
 			GHashTable *components;
-			components = g_hash_table_new_full(g_str_hash, g_str_equal,
-					g_free, g_free);
-			g_hash_table_replace(components, g_strdup("channel"),
-					g_strdup(conv->name));
+			PurpleAccount *account = purple_conversation_get_account(conv);
+			PurplePlugin *prpl = purple_find_prpl(purple_account_get_protocol_id(account));
+			PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
+			if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, chat_info_defaults)) {
+				components = prpl_info->chat_info_defaults(purple_account_get_connection(account),
+						purple_conversation_get_name(conv));
+			} else {
+				components = g_hash_table_new_full(g_str_hash, g_str_equal,
+						g_free, g_free);
+				g_hash_table_replace(components, g_strdup("channel"),
+						g_strdup(purple_conversation_get_name(conv)));
+			}
 			chat = purple_chat_new(conv->account, NULL, components);
 			purple_blist_node_set_flags((PurpleBlistNode *)chat,
 					PURPLE_BLIST_NODE_FLAG_NO_SAVE);