changeset 254:b0c531678919

2003-8-11 Brian Masney <masneyb@gftp.org> * src/gtk/menu-items.c lib/rfc959.c - fix for selecting ASCII/Binary transfers
author masneyb
date Tue, 12 Aug 2003 00:38:06 +0000
parents a46c2eef5139
children 2ad324cf4930
files ChangeLog lib/rfc959.c src/gtk/menu-items.c
diffstat 3 files changed, 17 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Aug 12 00:04:37 2003 +0000
+++ b/ChangeLog	Tue Aug 12 00:38:06 2003 +0000
@@ -1,4 +1,7 @@
 2003-8-11 Brian Masney <masneyb@gftp.org>
+	* src/gtk/menu-items.c lib/rfc959.c - fix for selecting ASCII/Binary 
+	transfers
+
 	* src/gtk/delete_dialog.c - don't attempt to clear the cache for the
 	protocols that have the cache disabled
 
@@ -1466,7 +1469,7 @@
 
 	* cvsclean - added this script
 
-	* *.[ch] - added $Id: ChangeLog,v 1.132 2003/08/12 00:04:36 masneyb Exp $ tags
+	* *.[ch] - added $Id: ChangeLog,v 1.133 2003/08/12 00:38:03 masneyb Exp $ tags
 
 	* debian/* - updated files from Debian maintainer
 
--- a/lib/rfc959.c	Tue Aug 12 00:04:37 2003 +0000
+++ b/lib/rfc959.c	Tue Aug 12 00:38:06 2003 +0000
@@ -88,8 +88,8 @@
 {
   gftp_getline_buffer * datafd_rbuf,
                       * dataconn_rbuf;
-  int is_ascii_transfer;
   int data_connection;
+  unsigned int is_ascii_transfer : 1;
 } rfc959_parms;
 
 
@@ -937,16 +937,16 @@
 
 
 static int
-rfc959_is_ascii_transfer (const char *filename)
+rfc959_is_ascii_transfer (gftp_request * request, const char *filename)
 {
   gftp_config_list_vars * tmplistvar;
   gftp_file_extensions * tempext;
+  int stlen, ascii_transfers;
   GList * templist;
-  int stlen, ret;
   
   gftp_lookup_global_option ("ext", &tmplistvar);
+  gftp_lookup_request_option (request, "ascii_transfers", &ascii_transfers);
 
-  ret = 0; 
   stlen = strlen (filename);
   for (templist = tmplistvar->list; templist != NULL; templist = templist->next)
     {
@@ -956,12 +956,14 @@
           strcmp (&filename[stlen - tempext->stlen], tempext->ext) == 0)
         {
           if (toupper (*tempext->ascii_binary == 'A'))
-            ret = 1; 
+            ascii_transfers = 1; 
+          else if (toupper (*tempext->ascii_binary == 'B'))
+            ascii_transfers = 0; 
           break;
         }
     }
 
-  return (ret);
+  return (ascii_transfers);
 }
 
 
@@ -976,7 +978,7 @@
   g_return_if_fail (request->protonum == GFTP_FTP_NUM);
 
   parms = request->protocol_data;
-  new_ascii = rfc959_is_ascii_transfer (filename);
+  new_ascii = rfc959_is_ascii_transfer (request, filename);
 
   if (request->datafd > 0 && new_ascii != parms->is_ascii_transfer)
     {
@@ -988,7 +990,7 @@
       else
         {
 	  tempstr = "TYPE I\r\n";
-          parms->is_ascii_transfer = 1;
+          parms->is_ascii_transfer = 0;
         }
 
       rfc959_send_command (request, tempstr);
@@ -1241,6 +1243,7 @@
   g_return_val_if_fail (request->datafd > 0, GFTP_EFATAL);
 
   parms = request->protocol_data;
+
   if (parms->data_connection > 0)
     {
       close (parms->data_connection);
--- a/src/gtk/menu-items.c	Tue Aug 12 00:04:37 2003 +0000
+++ b/src/gtk/menu-items.c	Tue Aug 12 00:38:06 2003 +0000
@@ -26,18 +26,10 @@
   switch (menuitem)
     {
     case 1:
-      if (window1.request != NULL)
-        gftp_set_request_option (window1.request, "ascii_transfers", GINT_TO_POINTER(1));
-
-      if (window2.request != NULL)
-        gftp_set_request_option (window2.request, "ascii_transfers", GINT_TO_POINTER(1));
+      gftp_set_global_option ("ascii_transfers", GINT_TO_POINTER(1));
       break;
     case 2:
-      if (window1.request != NULL)
-        gftp_set_request_option (window1.request, "ascii_transfers", GINT_TO_POINTER(0));
-
-      if (window2.request != NULL)
-        gftp_set_request_option (window2.request, "ascii_transfers", GINT_TO_POINTER(0));
+      gftp_set_global_option ("ascii_transfers", GINT_TO_POINTER(0));
       break;
     case 3:
       current_wdata = &window1;