changeset 7650:6db061321ec4

[gaim-migrate @ 8293] I completely reverted the dnd sendfile stuff. I thought most of it was pretty decent. The parts for adding the sendfile option to the conv window looked good to me. I can't comment on the dnd stuff. In oscar.c, I didn't see a need to duplicate the oscar_ask_sendfile function. I also don't think the right click->send file option should have been removed... but that's just one man's opinion. Sean, could you please talk to Chip and/or the author of this patch and work towards making it acceptable by you? committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Fri, 28 Nov 2003 19:30:45 +0000
parents 7762b3bdfe09
children 580bd39219a2
files src/gtkblist.c src/gtkconv.c src/gtkconv.h src/protocols/oscar/oscar.c src/prpl.c src/prpl.h src/server.c
diffstat 7 files changed, 15 insertions(+), 175 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkblist.c	Fri Nov 28 19:10:57 2003 +0000
+++ b/src/gtkblist.c	Fri Nov 28 19:30:45 2003 +0000
@@ -2255,11 +2255,12 @@
 
 
 	/* Set up dnd */
-	gtk_tree_view_enable_model_drag_source(GTK_TREE_VIEW(gtkblist->treeview), GDK_BUTTON1_MASK, gte,
-					       2, GDK_ACTION_COPY);
-
-        gtk_tree_view_enable_model_drag_dest(GTK_TREE_VIEW(gtkblist->treeview), gte, 2,
-					     GDK_ACTION_COPY | GDK_ACTION_MOVE);
+	gtk_tree_view_enable_model_drag_source(GTK_TREE_VIEW(gtkblist->treeview),
+										   GDK_BUTTON1_MASK, gte, 2, 
+										   GDK_ACTION_COPY);
+	gtk_tree_view_enable_model_drag_dest(GTK_TREE_VIEW(gtkblist->treeview),
+										 gte, 2,
+										 GDK_ACTION_COPY | GDK_ACTION_MOVE);
 
   	g_signal_connect(G_OBJECT(gtkblist->treeview), "drag-data-received", G_CALLBACK(gaim_gtk_blist_drag_data_rcv_cb), NULL);
 	g_signal_connect(G_OBJECT(gtkblist->treeview), "drag-data-get", G_CALLBACK(gaim_gtk_blist_drag_data_get_cb), NULL);
--- a/src/gtkconv.c	Fri Nov 28 19:10:57 2003 +0000
+++ b/src/gtkconv.c	Fri Nov 28 19:30:45 2003 +0000
@@ -881,20 +881,6 @@
 }
 
 static void
-menu_sendfile_cb(gpointer data, guint action, GtkWidget *widget)
-{
-	GaimConvWindow *win = (GaimConvWindow *)data;
-	GaimConversation *conv;
-	GaimConnection *gc;
-
-	conv = gaim_conv_window_get_active_conversation(win);
-
-	gc = gaim_conversation_get_gc(conv);
-
-	gaim_prpl_ask_send_file (gc, gaim_conversation_get_name (conv));
-}
-
-static void
 menu_warn_cb(gpointer data, guint action, GtkWidget *widget)
 {
 	GaimConvWindow *win = (GaimConvWindow *)data;
@@ -2093,24 +2079,6 @@
 		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
 	}
 
-
-	if (gaim_prpl_has_send_file (gc, gaim_conversation_get_name(conv))) {
-		gtk_widget_show(gtkwin->menu.sendfile);
-		gtk_widget_set_sensitive(gtkwin->menu.sendfile, TRUE);
-	} else {
-		gtk_widget_hide(gtkwin->menu.sendfile);
-		gtk_widget_set_sensitive(gtkwin->menu.sendfile, FALSE);
-	}
-
-
-	if (gaim_prpl_has_send_file (gc, gaim_conversation_get_name(conv))) {
-		gtk_widget_show(gtkwin->menu.sendfile);
-		gtk_widget_set_sensitive(gtkwin->menu.sendfile, TRUE);
-	} else {
-		gtk_widget_hide(gtkwin->menu.sendfile);
-		gtk_widget_set_sensitive(gtkwin->menu.sendfile, FALSE);
-	}
-
 	/* Update the menubar */
 	if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) {
 		gtk_widget_show(gtkwin->menu.view_log);
@@ -2969,12 +2937,6 @@
 	{ N_("/Conversation/In_vite..."), NULL, menu_invite_cb, 0,
 	  "<StockItem>", GAIM_STOCK_INVITE },
 
-	{ N_("/Conversation/Send _File..."), NULL, menu_sendfile_cb, 0,
-	  "<StockItem>", GAIM_STOCK_INVITE },
-
-	{ N_("/Conversation/Send _File..."), NULL, menu_sendfile_cb, 0,
-	  "<StockItem>", GAIM_STOCK_INVITE },
-
 	{ "/Conversation/sep2", NULL, NULL, 0, "<Separator>" },
 
 	{ N_("/Conversation/Insert _URL..."), NULL, menu_insert_link_cb, 0,
@@ -3063,14 +3025,6 @@
 		gtk_item_factory_get_widget(gtkwin->menu.item_factory,
 									N_("/Conversation/Invite..."));
 
-	gtkwin->menu.sendfile =
-		gtk_item_factory_get_widget(gtkwin->menu.item_factory,
-									N_("/Conversation/Send File..."));
-
-	gtkwin->menu.sendfile =
-		gtk_item_factory_get_widget(gtkwin->menu.item_factory,
-									N_("/Conversation/Send File..."));
-
 	/* --- */
 
 	gtkwin->menu.insert_link =
--- a/src/gtkconv.h	Fri Nov 28 19:10:57 2003 +0000
+++ b/src/gtkconv.h	Fri Nov 28 19:30:45 2003 +0000
@@ -55,7 +55,6 @@
 		GtkWidget *alias;
 		GtkWidget *get_info;
 		GtkWidget *invite;
-		GtkWidget *sendfile;
 
 		GtkWidget *warn;
 		GtkWidget *block;
--- a/src/protocols/oscar/oscar.c	Fri Nov 28 19:10:57 2003 +0000
+++ b/src/protocols/oscar/oscar.c	Fri Nov 28 19:30:45 2003 +0000
@@ -1025,57 +1025,6 @@
 	gaim_xfer_request(xfer);
 }
 
-static void oscar_sendfile(GaimConnection *gc, const char *destsn, const char *file) {
-	OscarData *od = (OscarData *)gc->proto_data;
-	GaimXfer *xfer;
-	struct aim_oft_info *oft_info;
-
-	/* You want to send a file to someone else, you're so generous */
-
-	/* Build the file transfer handle */
-	xfer = gaim_xfer_new(gaim_connection_get_account(gc), GAIM_XFER_SEND, destsn);
-	xfer->local_port = 5190;
-
-	/* Create the oscar-specific data */
-	oft_info = aim_oft_createinfo(od->sess, NULL, destsn, xfer->local_ip, xfer->local_port, 0, 0, NULL);
-	xfer->data = oft_info;
-
-	 /* Setup our I/O op functions */
-	gaim_xfer_set_init_fnc(xfer, oscar_xfer_init);
-	gaim_xfer_set_start_fnc(xfer, oscar_xfer_start);
-	gaim_xfer_set_end_fnc(xfer, oscar_xfer_end);
-	gaim_xfer_set_cancel_send_fnc(xfer, oscar_xfer_cancel_send);
-	gaim_xfer_set_cancel_recv_fnc(xfer, oscar_xfer_cancel_recv);
-	gaim_xfer_set_ack_fnc(xfer, oscar_xfer_ack);
-
-	/* Keep track of this transfer for later */
-	od->file_transfers = g_slist_append(od->file_transfers, xfer);
-
-	/* We don't need to request, since it has already been accepted */
-	gaim_xfer_request_accepted (xfer, g_strdup(file));
-}
-
-static gboolean oscar_has_sendfile (GaimConnection *gc, const char *who)
-{
-	GaimBuddy *b = NULL;
-	aim_userinfo_t *userinfo;
-        OscarData *od = gc->proto_data;
-	
-	if(who)
-		b = gaim_find_buddy(gc->account, who);
-	
-	if (b)
-		userinfo = aim_locate_finduserinfo(od->sess, b->name);
-
-	if(userinfo) {
-		/* True if we can send files to this dude, false if we can't */
-		return userinfo->capabilities & AIM_CAPS_SENDFILE;
-	}
-	else
-		return FALSE;
-
-}
-
 static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) {
 	GaimConnection *gc = sess->aux_data;
 	OscarData *od = gc->proto_data;
@@ -6278,6 +6227,14 @@
 				pbm->gc = gc;
 				m = g_list_append(m, pbm);
 			}
+
+			if (userinfo->capabilities & AIM_CAPS_SENDFILE) {
+				pbm = g_new0(struct proto_buddy_menu, 1);
+				pbm->label = _("Send File");
+				pbm->callback = oscar_ask_sendfile;
+				pbm->gc = gc;
+				m = g_list_append(m, pbm);
+			}
 #if 0
 			if (userinfo->capabilities & AIM_CAPS_GETFILE) {
 				pbm = g_new0(struct proto_buddy_menu, 1);
@@ -6704,12 +6661,7 @@
 	NULL,
 	oscar_convo_closed,
 	NULL,
-	oscar_set_icon,
-	NULL,
-	NULL,
-	oscar_ask_sendfile,
-	oscar_sendfile,
-	oscar_has_sendfile
+	oscar_set_icon
 };
 
 static GaimPluginInfo info =
--- a/src/prpl.c	Fri Nov 28 19:10:57 2003 +0000
+++ b/src/prpl.c	Fri Nov 28 19:30:45 2003 +0000
@@ -96,33 +96,3 @@
 
 	return NULL;
 }
-
-void gaim_prpl_ask_send_file (GaimConnection *gc, const char *name)
-{
-	GaimPluginProtocolInfo *prpl_info = NULL;
- 
-        if (gc != NULL && gc->prpl != NULL)
-                prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
-
-	if (prpl_info->has_send_file == NULL || prpl_info->send_file == NULL)
-		return;	
-
-	prpl_info->ask_send_file(gc, name);
-}
-
-
-gboolean gaim_prpl_has_send_file (GaimConnection *gc, const char *name)
-{
-	GaimPluginProtocolInfo *prpl_info = NULL;
- 
-        if (gc != NULL && gc->prpl != NULL)
-                prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
-
-	if (prpl_info->has_send_file == NULL || prpl_info->send_file == NULL)
-		return FALSE;
-	if(name)
-		return prpl_info->has_send_file(gc, name);
-
-	return 0;
-	
-}
--- a/src/prpl.h	Fri Nov 28 19:10:57 2003 +0000
+++ b/src/prpl.h	Fri Nov 28 19:30:45 2003 +0000
@@ -313,12 +313,6 @@
 	void (*remove_group)(GaimConnection *gc, const char *group);
 
 	char *(*get_cb_real_name)(GaimConnection *gc, int id, const char *who);
-
-	void (*ask_send_file)(GaimConnection *gc, const char *who);
-
-	void (*send_file)(GaimConnection *gc, const char *who, const char *file);
-
-	gboolean (*has_send_file)(GaimConnection *gc, const char *who);
 };
 
 #define GAIM_IS_PROTOCOL_PLUGIN(plugin) \
@@ -357,23 +351,6 @@
  */
 GaimPlugin *gaim_find_prpl(GaimProtocol type);
 
-/**
- * Ask the user to select a file to send to a user
- *
- * @param gc The Gaim Connection to send the file trough;
- * @param name The screen name of the one we are sending the file;
- */
-void gaim_prpl_ask_send_file (GaimConnection *gc, const char *name);
-
-/**
- * Checks if a given user supports file sends
- *
- * @param gc The Gaim Connection to send the file trough;
- * @param name The screen name of the one we are sending the file;
- * @return TRUE if we can send files to this user, FALSE otherwise.
- */
-gboolean gaim_prpl_has_send_file (GaimConnection *gc, const char *name);
-
 #ifdef __cplusplus
 }
 #endif
--- a/src/server.c	Fri Nov 28 19:10:57 2003 +0000
+++ b/src/server.c	Fri Nov 28 19:30:45 2003 +0000
@@ -291,19 +291,6 @@
 	return val;
 }
 
-void serv_send_file(GaimConnection *gc, const char *name, const char *file)
-{
-	GaimPluginProtocolInfo *prpl_info = NULL;
-
-	if (gc != NULL && gc->prpl != NULL)
-		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
-
-	if (prpl_info->send_file == NULL || file == NULL || name ==  NULL)
-		return;
-
-	prpl_info->send_file(gc, name, file);
-}
-
 void serv_get_info(GaimConnection *g, const char *name)
 {
 	GaimPluginProtocolInfo *prpl_info = NULL;