Mercurial > pidgin
diff src/protocols/yahoo/yahoo_filexfer.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 | 2219f4bf4a57 |
children | de798f2f4bf1 |
line wrap: on
line diff
--- a/src/protocols/yahoo/yahoo_filexfer.c Sat Nov 19 00:16:45 2005 +0000 +++ b/src/protocols/yahoo/yahoo_filexfer.c Sat Nov 19 00:26:12 2005 +0000 @@ -506,21 +506,20 @@ gaim_xfer_request(xfer); } -void yahoo_send_file(GaimConnection *gc, const char *who, const char *file) +GaimXfer *yahoo_new_xfer(GaimConnection *gc, const char *who) { GaimXfer *xfer; struct yahoo_xfer_data *xfer_data; - - if (!who) - return; - + + g_return_val_if_fail(who != NULL, NULL); + xfer_data = g_new0(struct yahoo_xfer_data, 1); xfer_data->gc = gc; - + /* Build the file transfer handle. */ xfer = gaim_xfer_new(gc->account, GAIM_XFER_SEND, who); xfer->data = xfer_data; - + /* Setup our I/O op functions */ gaim_xfer_set_init_fnc(xfer, yahoo_xfer_init); gaim_xfer_set_start_fnc(xfer, yahoo_xfer_start); @@ -530,6 +529,15 @@ gaim_xfer_set_read_fnc(xfer, yahoo_xfer_read); gaim_xfer_set_write_fnc(xfer, yahoo_xfer_write); + return xfer; +} + +void yahoo_send_file(GaimConnection *gc, const char *who, const char *file) +{ + GaimXfer *xfer = yahoo_new_xfer(gc, who); + + g_return_if_fail(xfer != NULL); + /* Now perform the request */ if (file) gaim_xfer_request_accepted(xfer, file);