changeset 10431:843ed1f2bf3f

[gaim-migrate @ 11683] Feature request #1022776, from Kristof Vansant: Clicking on IM in a chat channel, new tab should get focus And of course some minor code cleanup and reuse :-D committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 27 Dec 2004 07:21:45 +0000
parents f5508fbf6764
children dc4475bf718f
files src/blist.c src/gtkconv.c
diffstat 2 files changed, 15 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/src/blist.c	Mon Dec 27 06:47:04 2004 +0000
+++ b/src/blist.c	Mon Dec 27 07:21:45 2004 +0000
@@ -31,6 +31,7 @@
 #include "server.h"
 #include "signals.h"
 #include "util.h"
+#include "value.h"
 #include "xmlnode.h"
 
 #define PATHSIZE 1024
@@ -132,6 +133,8 @@
 	data = (const char *)value;
 	node = (xmlnode *)user_data;
 
+	g_return_if_fail(data != NULL);
+
 	child = xmlnode_new_child(node, "component");
 	xmlnode_set_attrib(child, "name", name);
 	xmlnode_insert_data(child, data, -1);
--- a/src/gtkconv.c	Mon Dec 27 06:47:04 2004 +0000
+++ b/src/gtkconv.c	Mon Dec 27 07:21:45 2004 +0000
@@ -1239,18 +1239,21 @@
 static void
 chat_do_im(GaimConversation *conv, const char *who)
 {
+	GaimAccount *account;
+	GaimConnection *gc;
 	GaimPluginProtocolInfo *prpl_info = NULL;
 	char *real_who;
-	GaimConversation *conv2;
-	GaimAccount *account;
 
 	account = gaim_conversation_get_account(conv);
-
-	if(account && account->gc)
-		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl);
-
-	if(prpl_info && prpl_info->get_cb_real_name)
-		real_who = prpl_info->get_cb_real_name(account->gc,
+	g_return_if_fail(account != NULL);
+
+	gc = gaim_account_get_connection(account);
+	g_return_if_fail(gc != NULL);
+
+	prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
+
+	if (prpl_info && prpl_info->get_cb_real_name)
+		real_who = prpl_info->get_cb_real_name(gc,
 				gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who);
 	else
 		real_who = g_strdup(who);
@@ -1258,17 +1261,11 @@
 	if(!real_who)
 		return;
 
-	conv2 = gaim_find_conversation_with_account(GAIM_CONV_IM, real_who, account);
-
-	if (conv2 != NULL)
-		gaim_conv_window_show(gaim_conversation_get_window(conv2));
-	else
-		conv2 = gaim_conversation_new(GAIM_CONV_IM, account, real_who);
+	gaim_gtkdialogs_im_with_user(account, real_who);
 
 	g_free(real_who);
 }
 
-
 static void
 chat_im_button_cb(GtkWidget *widget, GaimConversation *conv)
 {