# HG changeset patch # User masneyb # Date 1068294201 0 # Node ID cc2eeb30b7936b547ef0962a81deaade6ec550ac # Parent 758d9d648cc0b09df0740e6a9f8263b4ef508064 2003-11-7 Brian Masney * lib/gftp.h lib/local.c lib/protocols.c lib/rfc2068.c lib/rfc959.c lib/sshv2.c - added copy_param_options method to gftp_request structure. When a gftp_request structure is copied, if a copy_param_options method exists, this will be called so that the local protocol data can be copied over. This is only used by the FTP protocol at the moment to save the current state of Ascii or Binary transfers. * src/gtk/transfer.c (transfer_done) - when a transfer is completed, copy the local protocol options back to the main window * lib/rfc959.c (gftp_set_data_type) - check the return value of rfc959_send_command() and if there is an error, return that error. * configure.in - added 'hr' to ALL_LINGUAS diff -r 758d9d648cc0 -r cc2eeb30b793 ChangeLog --- a/ChangeLog Fri Nov 07 18:10:04 2003 +0000 +++ b/ChangeLog Sat Nov 08 12:23:21 2003 +0000 @@ -1,3 +1,21 @@ +2003-11-7 Brian Masney + * lib/gftp.h lib/local.c lib/protocols.c lib/rfc2068.c lib/rfc959.c + lib/sshv2.c - added copy_param_options method to gftp_request + structure. When a gftp_request structure is copied, if a + copy_param_options method exists, this will be called so that the + local protocol data can be copied over. This is only used by the + FTP protocol at the moment to save the current state of Ascii or + Binary transfers. + + * src/gtk/transfer.c (transfer_done) - when a transfer is + completed, copy the local protocol options back to the main window + + * lib/rfc959.c (gftp_set_data_type) - check the return value of + rfc959_send_command() and if there is an error, return that + error. + + * configure.in - added 'hr' to ALL_LINGUAS + 2003-11-5 Brian Masney * TODO - updated @@ -1709,7 +1727,7 @@ * cvsclean - added this script - * *.[ch] - added $Id: ChangeLog,v 1.168 2003/11/06 03:19:00 masneyb Exp $ tags + * *.[ch] - added $Id: ChangeLog,v 1.169 2003/11/08 12:23:20 masneyb Exp $ tags * debian/* - updated files from Debian maintainer diff -r 758d9d648cc0 -r cc2eeb30b793 configure.in --- a/configure.in Fri Nov 07 18:10:04 2003 +0000 +++ b/configure.in Sat Nov 08 12:23:21 2003 +0000 @@ -28,7 +28,7 @@ AC_SUBST(VERSION) AC_SUBST(PREFIX) -ALL_LINGUAS="am az ar be bg bn ca cs da de el es fi fr hu it ja ko mk ml ms nl no pl pt pt_BR ro ru sk sr sr@Latn sv tr uk zh_CN zh_TW" +ALL_LINGUAS="am az ar be bg bn ca cs da de el es fi fr hr hu it ja ko mk ml ms nl no pl pt pt_BR ro ru sk sr sr@Latn sv tr uk zh_CN zh_TW" AC_DEFINE(_GNU_SOURCE, 1, [Define for setting a GNU environment]) @@ -285,4 +285,4 @@ AC_CHECK_PROG(DB2HTML, db2html, true, false) AM_CONDITIONAL(HAVE_DOCBOOK, $DB2HTML) -AC_OUTPUT(Makefile docs/Makefile docs/sample.gftp/Makefile lib/Makefile src/gftp src/Makefile src/gtk/Makefile src/text/Makefile gftp.spec intl/Makefile po/Makefile.in) +AC_OUTPUT(Makefile docs/Makefile docs/sample.gftp/Makefile lib/Makefile src/gftp src/Makefile src/gtk/Makefile src/text/Makefile gftp.spec intl/Makefile po/Makefile.in intl/Makefile po/Makefile.in ) diff -r 758d9d648cc0 -r cc2eeb30b793 lib/gftp.h --- a/lib/gftp.h Fri Nov 07 18:10:04 2003 +0000 +++ b/lib/gftp.h Sat Nov 08 12:23:21 2003 +0000 @@ -350,6 +350,8 @@ void *user_data; int (*init) ( gftp_request * request ); + void (*copy_param_options) ( gftp_request * dest_request, + gftp_request * src_request ); ssize_t (*read_function) ( gftp_request * request, void *ptr, size_t size, @@ -763,6 +765,9 @@ void gftp_request_destroy ( gftp_request * request, int free_request ); +void gftp_copy_param_options ( gftp_request * dest_request, + gftp_request * src_request ); + void gftp_file_destroy ( gftp_file *file ); int gftp_connect ( gftp_request * request ); diff -r 758d9d648cc0 -r cc2eeb30b793 lib/local.c --- a/lib/local.c Fri Nov 07 18:10:04 2003 +0000 +++ b/lib/local.c Sat Nov 08 12:23:21 2003 +0000 @@ -638,6 +638,7 @@ request->protonum = GFTP_LOCAL_NUM; request->init = local_init; + request->copy_param_options = NULL; request->destroy = local_destroy; request->read_function = gftp_fd_read; request->write_function = gftp_fd_write; diff -r 758d9d648cc0 -r cc2eeb30b793 lib/misc.c --- a/lib/misc.c Fri Nov 07 18:10:04 2003 +0000 +++ b/lib/misc.c Sat Nov 08 12:23:21 2003 +0000 @@ -667,6 +667,8 @@ return (NULL); } + gftp_copy_param_options (newreq, req); + return (newreq); } diff -r 758d9d648cc0 -r cc2eeb30b793 lib/protocols.c --- a/lib/protocols.c Fri Nov 07 18:10:04 2003 +0000 +++ b/lib/protocols.c Sat Nov 08 12:23:21 2003 +0000 @@ -83,6 +83,22 @@ } +/* This function is called to copy protocol specific data from one request + structure to another. This is typically called when a file transfer is + completed, state information can be copied back to the main window */ +void +gftp_copy_param_options (gftp_request * dest_request, + gftp_request * src_request) +{ + g_return_if_fail (dest_request != NULL); + g_return_if_fail (src_request != NULL); + g_return_if_fail (dest_request->protonum == src_request->protonum); + + if (dest_request->copy_param_options) + dest_request->copy_param_options (dest_request, src_request); +} + + void gftp_file_destroy (gftp_file * file) { diff -r 758d9d648cc0 -r cc2eeb30b793 lib/rfc2068.c --- a/lib/rfc2068.c Fri Nov 07 18:10:04 2003 +0000 +++ b/lib/rfc2068.c Sat Nov 08 12:23:21 2003 +0000 @@ -912,6 +912,7 @@ request->protonum = GFTP_HTTP_NUM; request->init = rfc2068_init; + request->copy_param_options = NULL; request->read_function = rfc2068_chunked_read; request->write_function = gftp_fd_write; request->destroy = rfc2068_destroy; diff -r 758d9d648cc0 -r cc2eeb30b793 lib/rfc959.c --- a/lib/rfc959.c Fri Nov 07 18:10:04 2003 +0000 +++ b/lib/rfc959.c Sat Nov 08 12:23:21 2003 +0000 @@ -1001,15 +1001,15 @@ } -static void +static int rfc959_set_data_type (gftp_request * request, const char *filename) { rfc959_parms * parms; - int new_ascii; + int new_ascii, ret; char *tempstr; - g_return_if_fail (request != NULL); - g_return_if_fail (request->protonum == GFTP_FTP_NUM); + g_return_val_if_fail (request != NULL, GFTP_EFATAL); + g_return_val_if_fail (request->protonum == GFTP_FTP_NUM, GFTP_EFATAL); parms = request->protocol_data; new_ascii = rfc959_is_ascii_transfer (request, filename); @@ -1027,10 +1027,11 @@ parms->is_ascii_transfer = 0; } - rfc959_send_command (request, tempstr, 1); + if ((ret = rfc959_send_command (request, tempstr, 1)) < 0) + return (ret); } - return; + return (0); } @@ -1051,7 +1052,8 @@ if (fd > 0) parms->data_connection = fd; - rfc959_set_data_type (request, filename); + if ((ret = rfc959_set_data_type (request, filename)) < 0) + return (ret); if (parms->data_connection < 0 && (ret = rfc959_data_connection_new (request)) < 0) @@ -1125,7 +1127,8 @@ if (fd > 0) fd = parms->data_connection; - rfc959_set_data_type (request, filename); + if ((ret = rfc959_set_data_type (request, filename)) < 0) + return (ret); if (parms->data_connection < 0 && (ret = rfc959_data_connection_new (request)) < 0) @@ -1690,6 +1693,19 @@ } +void +rfc959_copy_param_options (gftp_request * dest_request, + gftp_request * src_request) +{ + rfc959_parms * dparms, * sparms; + + dparms = dest_request->protocol_data; + sparms = src_request->protocol_data; + + dparms->is_ascii_transfer = sparms->is_ascii_transfer; +} + + int rfc959_init (gftp_request * request) { @@ -1719,6 +1735,7 @@ request->protonum = GFTP_FTP_NUM; request->init = rfc959_init; + request->copy_param_options = rfc959_copy_param_options; request->destroy = rfc959_request_destroy; request->read_function = gftp_fd_read; request->write_function = gftp_fd_write; diff -r 758d9d648cc0 -r cc2eeb30b793 lib/sshv2.c --- a/lib/sshv2.c Fri Nov 07 18:10:04 2003 +0000 +++ b/lib/sshv2.c Sat Nov 08 12:23:21 2003 +0000 @@ -2263,6 +2263,7 @@ request->protonum = GFTP_SSHV2_NUM; request->init = sshv2_init; + request->copy_param_options = NULL; request->destroy = sshv2_destroy; request->read_function = gftp_fd_read; request->write_function = gftp_fd_write; diff -r 758d9d648cc0 -r cc2eeb30b793 src/gtk/transfer.c --- a/src/gtk/transfer.c Fri Nov 07 18:10:04 2003 +0000 +++ b/src/gtk/transfer.c Sat Nov 08 12:23:21 2003 +0000 @@ -1227,15 +1227,23 @@ if (GFTP_IS_SAME_HOST_STOP_TRANS ((gftp_window_data *) tdata->fromwdata, tdata->fromreq)) - gftp_swap_socks (((gftp_window_data *) tdata->fromwdata)->request, - tdata->fromreq); + { + gftp_copy_param_options (((gftp_window_data *) tdata->fromwdata)->request, tdata->fromreq); + + gftp_swap_socks (((gftp_window_data *) tdata->fromwdata)->request, + tdata->fromreq); + } else gftp_disconnect (tdata->fromreq); if (GFTP_IS_SAME_HOST_STOP_TRANS ((gftp_window_data *) tdata->towdata, tdata->toreq)) - gftp_swap_socks (((gftp_window_data *) tdata->towdata)->request, - tdata->toreq); + { + gftp_copy_param_options (((gftp_window_data *) tdata->towdata)->request, tdata->toreq); + + gftp_swap_socks (((gftp_window_data *) tdata->towdata)->request, + tdata->toreq); + } else gftp_disconnect (tdata->toreq);