pidgin: 30d7397e: Fix creating a conversation with a user ...

sadrul at pidgin.im sadrul at pidgin.im
Wed Oct 21 21:25:42 EDT 2009


-----------------------------------------------------------------
Revision: 30d7397ebfa0e1d01b4951841f175a642d37a9ce
Ancestor: dc30097849427a1f44da9b415d72e65266d6f4fe
Author: sadrul at pidgin.im
Date: 2009-10-22T01:19:22
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/30d7397ebfa0e1d01b4951841f175a642d37a9ce

Modified files:
        finch/gntconv.c

ChangeLog: 

Fix creating a conversation with a user in a chatroom from the userlist.

-------------- next part --------------
============================================================
--- finch/gntconv.c	d4624b1133fb33ea63738d27715bee520511498c
+++ finch/gntconv.c	d77932f148a79f2275ea43b050687c588b18aa04
@@ -662,8 +662,25 @@ create_conv_from_userlist(GntWidget *wid
 create_conv_from_userlist(GntWidget *widget, FinchConv *fc)
 {
 	PurpleAccount *account = purple_conversation_get_account(fc->active_conv);
-	char *name = gnt_tree_get_selection_data(GNT_TREE(widget));
-	purple_conversation_new(PURPLE_CONV_TYPE_IM, account, name);
+	PurpleConnection *gc = purple_account_get_connection(account);
+	PurplePluginProtocolInfo *prpl_info = NULL;
+	char *name, *realname;
+
+	if (!gc) {
+		purple_conversation_write(fc->active_conv, NULL, _("You are not connected."),
+				PURPLE_MESSAGE_SYSTEM, time(NULL));
+		return;
+	}
+
+	name = gnt_tree_get_selection_data(GNT_TREE(widget));
+
+	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
+	if (prpl_info && PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, get_cb_real_name))
+		realname = prpl_info->get_cb_real_name(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(fc->active_conv)), name);
+	else
+		realname = NULL;
+	purple_conversation_new(PURPLE_CONV_TYPE_IM, account, realname ? realname : name);
+	g_free(realname);
 }
 
 static void


More information about the Commits mailing list