diff src/uicommon/gftpui.c @ 510:e0585b062a75

2004-7-24 Brian Masney <masneyb@gftp.org> * src/uicommon/gftpui.c src/uicommon/gftpui.h - added support for a custom connect and disconnect function in the thread callback * lib/local.c (local_connect) - don't step on request->directory if it is already set to the current working directory
author masneyb
date Sat, 24 Jul 2004 12:43:03 +0000
parents 93d7d3b9a477
children c3ff4479a92d
line wrap: on
line diff
--- a/src/uicommon/gftpui.c	Sat Jul 24 12:14:32 2004 +0000
+++ b/src/uicommon/gftpui.c	Sat Jul 24 12:43:03 2004 +0000
@@ -28,6 +28,26 @@
 gftp_logging_func gftpui_common_logfunc;
 
 
+static int
+_gftpui_cb_connect (gftpui_callback_data * cdata)
+{
+  if (cdata->connect_function != NULL)
+    return (cdata->connect_function (cdata));
+  else
+    return (gftp_connect (cdata->request));
+}
+
+
+static void
+_gftpui_cb_disconnect (gftpui_callback_data * cdata)
+{
+  if (cdata->connect_function != NULL)
+    cdata->disconnect_function (cdata);
+  else
+    gftp_disconnect (cdata->request);
+}
+
+
 static void *
 _gftpui_common_thread_callback (void * data)
 { 
@@ -58,7 +78,7 @@
           if (success == GFTP_ETIMEDOUT && num_timeouts == 0)
             {
               num_timeouts++;
-              if (gftp_connect (cdata->request) == 0)
+              if (_gftpui_cb_connect (cdata) == 0)
                 continue;
             }
 
@@ -75,6 +95,7 @@
     }
   else
     {
+      _gftpui_cb_disconnect (cdata);
       gftp_disconnect (cdata->request);
       cdata->request->logging_function (gftp_logging_error, cdata->request,
                                         _("Operation canceled\n"));