diff src/protocols/irc/dcc_send.c @ 12143:cbebda5f019c

[gaim-migrate @ 14444] SF Patch #1360399 from Evan Schoenberg (evands) "I discussed this previously with Mark and he said it'd be fine. This factors out the part of the send_file function which creates a new GaimXfer into a separate prpl function, new_xfer. It's called in each of the existing send_file functions. This is needed so that another client (okay, Adium) can get a new outgoing GaimXfer from a prpl without depending upon the specific ft.c logic of send_file; previously I was adding a duplicate method to each prpl and then calling it directly." I fixed a couple small bugs in this. Otherwise, it looks good, and seems like a reasonable libgaim request. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Sat, 19 Nov 2005 00:26:12 +0000
parents f9c5480ad0ce
children de798f2f4bf1
line wrap: on
line diff
--- a/src/protocols/irc/dcc_send.c	Sat Nov 19 00:16:45 2005 +0000
+++ b/src/protocols/irc/dcc_send.c	Sat Nov 19 00:26:12 2005 +0000
@@ -294,30 +294,36 @@
 	g_free(tmp);
 }
 
-/**
- * Gaim calls this function when the user selects Send File from the
- * buddy menu
- * It sets up the GaimXfer struct and tells Gaim to go ahead
- */
-void irc_dccsend_send_file(GaimConnection *gc, const char *who, const char *file) {
+GaimXfer *irc_dccsend_new_xfer(GaimConnection *gc, const char *who) {
 	GaimXfer *xfer;
 	struct irc_xfer_send_data *xd;
 
 	/* Build the file transfer handle */
 	xfer = gaim_xfer_new(gaim_connection_get_account(gc), GAIM_XFER_SEND, who);
 
-
 	xd = g_new0(struct irc_xfer_send_data, 1);
 	xd->fd = -1;
 	xfer->data = xd;
 
-	 /* Setup our I/O op functions */
+	/* Setup our I/O op functions */
 	gaim_xfer_set_init_fnc(xfer, irc_dccsend_send_init);
 	gaim_xfer_set_write_fnc(xfer, irc_dccsend_send_write);
 	gaim_xfer_set_end_fnc(xfer, irc_dccsend_send_destroy);
 	gaim_xfer_set_request_denied_fnc(xfer, irc_dccsend_send_destroy);
 	gaim_xfer_set_cancel_send_fnc(xfer, irc_dccsend_send_destroy);
-	/* Now perform the request */
+
+	return xfer;
+}
+
+/**
+ * Gaim calls this function when the user selects Send File from the
+ * buddy menu
+ * It sets up the GaimXfer struct and tells Gaim to go ahead
+ */
+void irc_dccsend_send_file(GaimConnection *gc, const char *who, const char *file) {
+	GaimXfer *xfer = irc_dccsend_new_xfer(gc, who);
+
+	/* Perform the request */
 	if (file)
 		gaim_xfer_request_accepted(xfer, file);
 	else