diff src/gtkconv.c @ 7712:2823111061ba

[gaim-migrate @ 8357] I did a few things to my drag-and-drop patch. First, I moved the application/x-im-contact parsing code into its own function, so we don't have to duplicate stuff. The reason I did this is because Sean suggested support for dragging x-im-contacts into conversation windows, which is also implemented now, and it rocks. :) committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Wed, 03 Dec 2003 02:03:25 +0000
parents 8a40952f5f67
children 9f6dc7b4fc57
line wrap: on
line diff
--- a/src/gtkconv.c	Wed Dec 03 01:27:53 2003 +0000
+++ b/src/gtkconv.c	Wed Dec 03 02:03:25 2003 +0000
@@ -3778,7 +3778,8 @@
 	GaimConvWindow *win = conv->window;
 	GaimConversation *c;
 
-	if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE)) {
+	if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE))
+	{
 		GaimBlistNode *n = NULL;
 		GaimBuddy *b;
 		memcpy(&n, sd->data, sizeof(n));
@@ -3794,6 +3795,32 @@
 
 		gaim_conv_window_add_conversation(win, c);
 	}
+	else if (sd->target == gdk_atom_intern("application/x-im-contact", FALSE))
+	{
+		char *protocol = NULL;
+		char *username = NULL;
+		GaimAccount *account;
+
+		if (gaim_gtk_parse_x_im_contact(sd->data, FALSE, &account,
+										&protocol, &username, NULL))
+		{
+			if (account == NULL)
+			{
+				gaim_notify_error(NULL, NULL,
+					_("You are not currently signed on with an account that "
+					  "can add that buddy."), NULL);
+			}
+			else
+			{
+				gaim_conversation_new(GAIM_CONV_IM, account, username);
+			}
+		}
+
+		if (username != NULL) g_free(username);
+		if (protocol != NULL) g_free(protocol);
+
+		gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
+	}
 }
 
 /**************************************************************************
@@ -3944,8 +3971,9 @@
 {
 	{"text/plain", 0, 0},
 	{"text/uri-list", 0, 1},
-	{"GAIM_BLIST_NODE", 0, 2},
-	{"STRING", 0, 3}
+	{"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, 2},
+	{"STRING", 0, 3},
+	{"application/x-im-contact", 0, 4}
 };
 
 static void