changeset 186:13ca1defdc75

2003-6-16 Brian Masney <masneyb@gftp.org> * lib/gftp.h src/text/gftp-text.c src/gtk/misc-gtk.c - changed 2nd parameter of logging function to be a request structure, instead of request->user_data. In the logging functions, if the string isn't in UTF-8, convert it with gftp_string_to_utf8() * lib/bookmark.c lib/cache.c lib/gftp.h lib/https.c lib/local.c lib/protocols.c lib/rfc2068.c lib/rfc959.c lib/sshv2.c lib/sslcommon.c src/gtk/chmod_dialog.c src/gtk/delete_dialog.c src/gtk/gftp-gtk.h src/gtk/menu-items.c src/gtk/misc-gtk.c src/gtk/mkdir_dialog.c src/gtk/rename_dialog.c src/gtk/transfer.c src/text/gftp-text.c src/gtk/gftp-gtk.h src/text/gftp-text.h - pass request structure to logging function instead of request->user_data
author masneyb
date Tue, 17 Jun 2003 10:49:16 +0000
parents cc94bd62d290
children a8ec69e39112
files ChangeLog lib/bookmark.c lib/cache.c lib/gftp.h lib/https.c lib/local.c lib/protocols.c lib/rfc2068.c lib/rfc959.c lib/sshv2.c lib/sslcommon.c src/gtk/chmod_dialog.c src/gtk/delete_dialog.c src/gtk/gftp-gtk.h src/gtk/menu-items.c src/gtk/misc-gtk.c src/gtk/mkdir_dialog.c src/gtk/rename_dialog.c src/gtk/transfer.c src/text/gftp-text.c src/text/gftp-text.h
diffstat 21 files changed, 297 insertions(+), 257 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Jun 17 10:13:26 2003 +0000
+++ b/ChangeLog	Tue Jun 17 10:49:16 2003 +0000
@@ -1,4 +1,17 @@
 2003-6-16 Brian Masney <masneyb@gftp.org>
+	* lib/gftp.h src/text/gftp-text.c src/gtk/misc-gtk.c - changed 2nd
+	parameter of logging function to be a request structure, instead of
+	request->user_data. In the logging functions, if the string isn't in
+	UTF-8, convert it with gftp_string_to_utf8()
+
+	* lib/bookmark.c lib/cache.c lib/gftp.h lib/https.c lib/local.c
+	lib/protocols.c lib/rfc2068.c lib/rfc959.c lib/sshv2.c lib/sslcommon.c
+	src/gtk/chmod_dialog.c src/gtk/delete_dialog.c src/gtk/gftp-gtk.h 
+	src/gtk/menu-items.c src/gtk/misc-gtk.c src/gtk/mkdir_dialog.c 
+	src/gtk/rename_dialog.c src/gtk/transfer.c src/text/gftp-text.c 
+	src/gtk/gftp-gtk.h src/text/gftp-text.h - pass request structure
+	to logging function instead of request->user_data
+
 	* lib/protocols.c (_gftp_get_next_charset) - set the separator for
 	remote charsets to be a comma
 
@@ -1008,7 +1021,7 @@
 
 	* cvsclean - added this script
 
-	* *.[ch] - added $Id: ChangeLog,v 1.91 2003/06/17 10:13:21 masneyb Exp $ tags
+	* *.[ch] - added $Id: ChangeLog,v 1.92 2003/06/17 10:49:13 masneyb Exp $ tags
 
 	* debian/* - updated files from Debian maintainer
 
--- a/lib/bookmark.c	Tue Jun 17 10:13:26 2003 +0000
+++ b/lib/bookmark.c	Tue Jun 17 10:49:16 2003 +0000
@@ -34,7 +34,7 @@
       pos += 3;
       if (strncmp (url, "bookmark://", 11) != 0)
         {
-          request->logging_function (gftp_logging_error, request->user_data,
+          request->logging_function (gftp_logging_error, request,
                                  _("Invalid URL %s\n"), url);
           return (GFTP_EFATAL);
         }
--- a/lib/cache.c	Tue Jun 17 10:13:26 2003 +0000
+++ b/lib/cache.c	Tue Jun 17 10:49:16 2003 +0000
@@ -44,7 +44,7 @@
   if ((pos = strchr (line, '\t')) == NULL || *(pos + 1) == '\0')
     {
       if (request != NULL)
-        request->logging_function (gftp_logging_error, request->user_data,
+        request->logging_function (gftp_logging_error, request,
                             _("Error: Invalid line %s in cache index file\n"), 
                             line);
       return (-1);
@@ -58,7 +58,7 @@
   if ((pos = strchr (pos, '\t')) == NULL || *(pos + 1) == '\0')
     {
       if (request != NULL)
-        request->logging_function (gftp_logging_error, request->user_data,
+        request->logging_function (gftp_logging_error, request,
                             _("Error: Invalid line %s in cache index file\n"), 
                             line);
       return (-1);
@@ -109,7 +109,7 @@
       if (mkdir (cachedir, S_IRUSR | S_IWUSR | S_IXUSR) < 0)
         {
           if (request != NULL)
-            request->logging_function (gftp_logging_error, request->user_data,
+            request->logging_function (gftp_logging_error, request,
                                  _("Error: Could not make directory %s: %s\n"),
                                  cachedir, g_strerror (errno));
 
@@ -133,7 +133,7 @@
     {
       g_free (tempstr);
       if (request != NULL)
-        request->logging_function (gftp_logging_error, request->user_data,
+        request->logging_function (gftp_logging_error, request,
                                  _("Error: Cannot create temporary file: %s\n"),
                                  g_strerror (errno));
       return (-1);
@@ -155,7 +155,7 @@
   if (close (fd) != 0 || ret < 0)
     {
       if (request != NULL)
-        request->logging_function (gftp_logging_error, request->user_data,
+        request->logging_function (gftp_logging_error, request,
                                    _("Error closing file descriptor: %s\n"),
                                    g_strerror (errno));
 
@@ -197,8 +197,7 @@
 	  if (close (indexfd) != 0)
             {
               if (request != NULL)
-                request->logging_function (gftp_logging_error, 
-                                       request->user_data,
+                request->logging_function (gftp_logging_error, request,
                                        _("Error closing file descriptor: %s\n"),
                                        g_strerror (errno));
               return (-1);
@@ -216,8 +215,7 @@
           if (lseek (cachefd, 0, SEEK_SET) == -1)
             {
               if (request != NULL)
-                request->logging_function (gftp_logging_error, 
-                                       request->user_data,
+                request->logging_function (gftp_logging_error, request,
                                        _("Error: Cannot seek on file %s: %s\n"),
                                        centry.file, g_strerror (errno));
 
--- a/lib/gftp.h	Tue Jun 17 10:13:26 2003 +0000
+++ b/lib/gftp.h	Tue Jun 17 10:49:16 2003 +0000
@@ -154,11 +154,6 @@
   gftp_logging_misc
 } gftp_logging_level;
 
-typedef void (*gftp_logging_func)		( gftp_logging_level level, 
-						  void *ptr, 
-						  const char *string, ... );
-
-
 typedef struct gftp_file_tag gftp_file;
 
 #define GFTP_TRANS_ACTION_OVERWRITE		1
@@ -295,6 +290,10 @@
 
 typedef struct gftp_request_tag gftp_request;
 
+typedef void (*gftp_logging_func)		( gftp_logging_level level, 
+						  gftp_request * request, 
+						  const char *string, ... );
+
 struct gftp_request_tag 
 {
   int protonum;			/* Current number of the protocol this is 
@@ -759,6 +758,11 @@
 
 int gftp_list_files 			( gftp_request * request );
 
+#if GLIB_MAJOR_VERSION > 1
+char * gftp_string_to_utf8		( gftp_request * request, 
+					  char *str );
+#endif
+
 int gftp_parse_bookmark 		( gftp_request * request, 
 					  const char * bookmark );
 
--- a/lib/https.c	Tue Jun 17 10:13:26 2003 +0000
+++ b/lib/https.c	Tue Jun 17 10:49:16 2003 +0000
@@ -85,7 +85,7 @@
 
   return (0);
 #else
-  request->logging_function (gftp_logging_error, request->user_data,
+  request->logging_function (gftp_logging_error, request,
                              _("HTTPS Support unavailable since SSL support was not compiled in. Aborting connection.\n"));
 
   return (GFTP_EFATAL);
--- a/lib/local.c	Tue Jun 17 10:13:26 2003 +0000
+++ b/lib/local.c	Tue Jun 17 10:49:16 2003 +0000
@@ -63,7 +63,7 @@
     {
       if (chdir (request->directory) != 0)
         {
-          request->logging_function (gftp_logging_error, request->user_data,
+          request->logging_function (gftp_logging_error, request,
                              _("Could not change local directory to %s: %s\n"),
                              request->directory, g_strerror (errno));
         }
@@ -77,7 +77,7 @@
       request->directory = g_strdup (tempstr);
     }
   else
-    request->logging_function (gftp_logging_error, request->user_data,
+    request->logging_function (gftp_logging_error, request,
                              _("Could not get current working directory: %s\n"),
                              g_strerror (errno));
 
@@ -94,7 +94,7 @@
   if (request->datafd != -1)
     {
       if (close (request->datafd) == -1)
-        request->logging_function (gftp_logging_error, request->user_data,
+        request->logging_function (gftp_logging_error, request,
                                    _("Error closing file descriptor: %s\n"),
                                    g_strerror (errno));
       request->datafd = -1;
@@ -128,7 +128,7 @@
 
   if ((size = lseek (request->datafd, 0, SEEK_END)) == -1)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Error: Cannot seek on file %s: %s\n"),
                                  filename, g_strerror (errno));
       gftp_disconnect (request);
@@ -137,7 +137,7 @@
 
   if (lseek (request->datafd, startsize, SEEK_SET) == -1)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Error: Cannot seek on file %s: %s\n"),
                                  filename, g_strerror (errno));
       gftp_disconnect (request);
@@ -175,7 +175,7 @@
 
   if (ftruncate (request->datafd, startsize) == -1)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                _("Error: Cannot truncate local file %s: %s\n"),
                                filename, g_strerror (errno));
       gftp_disconnect (request);
@@ -184,7 +184,7 @@
     
   if (lseek (request->datafd, startsize, SEEK_SET) == -1)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Error: Cannot seek on file %s: %s\n"),
                                  filename, g_strerror (errno));
       gftp_disconnect (request);
@@ -209,7 +209,7 @@
   if (request->datafd > 0)
     {
       if (close (request->datafd) == -1)
-        request->logging_function (gftp_logging_error, request->user_data,
+        request->logging_function (gftp_logging_error, request,
                                    _("Error closing file descriptor: %s\n"),
                                    g_strerror (errno));
 
@@ -401,7 +401,7 @@
 
   if ((lpd->dir = opendir (tempstr)) == NULL)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                            _("Could not get local directory listing %s: %s\n"),
                            tempstr, g_strerror (errno));
       if (freeit)
@@ -438,13 +438,13 @@
 
   if (chdir (directory) == 0)
     {
-      request->logging_function (gftp_logging_misc, request->user_data,
+      request->logging_function (gftp_logging_misc, request,
                           _("Successfully changed local directory to %s\n"),
                           directory);
 
       if (getcwd (tempstr, sizeof (tempstr)) == NULL)
         {
-          request->logging_function (gftp_logging_error, request->user_data,
+          request->logging_function (gftp_logging_error, request,
                             _("Could not get current working directory: %s\n"),
                             g_strerror (errno));
 	  return (GFTP_ERETRYABLE);
@@ -458,7 +458,7 @@
     }
   else
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                               _("Could not change local directory to %s: %s\n"),
                               directory, g_strerror (errno));
       return (GFTP_ERETRYABLE);
@@ -475,13 +475,13 @@
 
   if (rmdir (directory) == 0)
     {
-      request->logging_function (gftp_logging_misc, request->user_data,
+      request->logging_function (gftp_logging_misc, request,
                                  _("Successfully removed %s\n"), directory);
       return (0);
     }
   else
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                               _("Error: Could not remove directory %s: %s\n"),
                               directory, g_strerror (errno));
       return (GFTP_ERETRYABLE);
@@ -498,13 +498,13 @@
 
   if (unlink (file) == 0)
     {
-      request->logging_function (gftp_logging_misc, request->user_data,
+      request->logging_function (gftp_logging_misc, request,
                                  _("Successfully removed %s\n"), file);
       return (0);
     }
   else
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Error: Could not remove file %s: %s\n"),
                                  file, g_strerror (errno));
       return (GFTP_ERETRYABLE);
@@ -521,14 +521,14 @@
 
   if (mkdir (directory, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) == 0)
     {
-      request->logging_function (gftp_logging_misc, request->user_data,
+      request->logging_function (gftp_logging_misc, request,
                                  _("Successfully made directory %s\n"),
                                  directory);
       return (0);
     }
   else
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Error: Could not make directory %s: %s\n"),
                                  directory, g_strerror (errno));
       return (GFTP_ERETRYABLE);
@@ -547,14 +547,14 @@
 
   if (rename (oldname, newname) == 0)
     {
-      request->logging_function (gftp_logging_misc, request->user_data,
+      request->logging_function (gftp_logging_misc, request,
                                  _("Successfully renamed %s to %s\n"),
                                  oldname, newname);
       return (0);
     }
   else
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Error: Could not rename %s to %s: %s\n"),
                                  oldname, newname, g_strerror (errno));
       return (GFTP_ERETRYABLE);
@@ -577,14 +577,14 @@
 
   if (chmod (file, newmode) == 0) 
     {
-      request->logging_function (gftp_logging_misc, request->user_data, 
+      request->logging_function (gftp_logging_misc, request, 
                                  _("Successfully changed mode of %s to %d\n"),
                                  file, mode);
       return (0);
     }
   else 
     {
-      request->logging_function (gftp_logging_error, request->user_data, 
+      request->logging_function (gftp_logging_error, request, 
                           _("Error: Could not change mode of %s to %d: %s\n"),
                           file, mode, g_strerror (errno));
       return (GFTP_ERETRYABLE);
--- a/lib/protocols.c	Tue Jun 17 10:13:26 2003 +0000
+++ b/lib/protocols.c	Tue Jun 17 10:49:16 2003 +0000
@@ -155,7 +155,7 @@
   gftp_lookup_request_option (request, "maxkbs", &maxkbs);
   if (maxkbs > 0)
     {
-      request->logging_function (gftp_logging_misc, request->user_data,
+      request->logging_function (gftp_logging_misc, request,
                     _("File transfer will be throttled to %.2f KB/s\n"),
                     maxkbs);
     }
@@ -179,7 +179,7 @@
 
   if (maxkbs > 0)
     {
-      request->logging_function (gftp_logging_misc, request->user_data,
+      request->logging_function (gftp_logging_misc, request,
                     _("File transfer will be throttled to %.2f KB/s\n"), 
                     maxkbs);
     }
@@ -314,7 +314,7 @@
   request->cached = 0;
   if (request->use_cache && (fd = gftp_find_cache_entry (request)) > 0)
     {
-      request->logging_function (gftp_logging_misc, request->user_data,
+      request->logging_function (gftp_logging_misc, request,
                                  _("Loading directory listing %s from cache\n"),
                                  request->directory);
 
@@ -359,7 +359,7 @@
 }
 
 
-static char *
+char *
 gftp_string_to_utf8 (gftp_request * request, char *str)
 {
   char *ret, *remote_charsets, *stpos, *cur_charset;
@@ -442,7 +442,7 @@
           if (gftp_fd_write (request, request->last_dir_entry,
                           request->last_dir_entry_len, request->cachefd) < 0)
             {
-              request->logging_function (gftp_logging_error, request->user_data,
+              request->logging_function (gftp_logging_error, request,
                                         _("Error: Cannot write to cache: %s\n"),
                                         g_strerror (errno));
               close (request->cachefd);
@@ -473,14 +473,14 @@
   if ((tempentry = g_hash_table_lookup (gftp_bookmarks_htable, 
                                         bookmark)) == NULL)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Error: Could not find bookmark %s\n"), 
                                  bookmark);
       return (GFTP_EFATAL);
     }
   else if (tempentry->hostname == NULL || *tempentry->hostname == '\0')
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Bookmarks Error: The bookmark entry %s does not have a hostname\n"), bookmark);
       return (GFTP_EFATAL);
     }
@@ -890,13 +890,13 @@
   else
     snprintf (serv, sizeof (serv), "%d", port);
 
-  request->logging_function (gftp_logging_misc, request->user_data,
+  request->logging_function (gftp_logging_misc, request,
                              _("Looking up %s\n"), request->hostname);
 
   if ((errnum = getaddrinfo (request->hostname, serv, &hints, 
                              &request->hostp)) != 0)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Cannot look up hostname %s: %s\n"),
                                  request->hostname, gai_strerror (errnum));
       return (GFTP_ERETRYABLE);
@@ -905,13 +905,13 @@
   addr = request->hostp->ai_addr;
 
 #else /* !HAVE_GETADDRINFO */
-  request->logging_function (gftp_logging_misc, request->user_data,
+  request->logging_function (gftp_logging_misc, request,
                              _("Looking up %s\n"), request->hostname);
 
   if (!(request->hostp = r_gethostbyname (request->hostname, &request->host,
                                           NULL)))
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Cannot look up hostname %s: %s\n"),
                                  request->hostname, g_strerror (errno));
       return (GFTP_ERETRYABLE);
@@ -1705,12 +1705,12 @@
       else
         snprintf (serv, sizeof (serv), "%d", port);
 
-      request->logging_function (gftp_logging_misc, request->user_data,
+      request->logging_function (gftp_logging_misc, request,
                                  _("Looking up %s\n"), connect_host);
       if ((errnum = getaddrinfo (connect_host, serv, &hints, 
                                  &request->hostp)) != 0)
         {
-          request->logging_function (gftp_logging_error, request->user_data,
+          request->logging_function (gftp_logging_error, request,
                                      _("Cannot look up hostname %s: %s\n"),
                                      connect_host, gai_strerror (errnum));
           return (GFTP_ERETRYABLE);
@@ -1728,18 +1728,18 @@
       if ((sock = socket (res->ai_family, res->ai_socktype, 
                           res->ai_protocol)) < 0)
         {
-          request->logging_function (gftp_logging_error, request->user_data,
+          request->logging_function (gftp_logging_error, request,
                                      _("Failed to create a socket: %s\n"),
                                      g_strerror (errno));
           continue; 
         } 
 
-      request->logging_function (gftp_logging_misc, request->user_data,
+      request->logging_function (gftp_logging_misc, request,
                                  _("Trying %s:%d\n"), disphost, port);
 
       if (connect (sock, res->ai_addr, res->ai_addrlen) == -1)
         {
-          request->logging_function (gftp_logging_error, request->user_data,
+          request->logging_function (gftp_logging_error, request,
                                      _("Cannot connect to %s: %s\n"),
                                      disphost, g_strerror (errno));
           close (sock);
@@ -1771,7 +1771,7 @@
 
   if ((sock = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Failed to create a socket: %s\n"),
                                  g_strerror (errno));
       return (GFTP_ERETRYABLE);
@@ -1795,7 +1795,7 @@
     {
       if (!r_getservbyname (service, "tcp", &serv_struct, NULL))
         {
-          request->logging_function (gftp_logging_error, request->user_data,
+          request->logging_function (gftp_logging_error, request,
                                      _("Cannot look up service name %s/tcp. Please check your services file\n"),
                                      service);
           close (sock);
@@ -1814,12 +1814,12 @@
 
   if (request->hostp == NULL)
     {
-      request->logging_function (gftp_logging_misc, request->user_data,
+      request->logging_function (gftp_logging_misc, request,
                                  _("Looking up %s\n"), connect_host);
       if (!(request->hostp = r_gethostbyname (connect_host, &request->host,
                                               NULL)))
         {
-          request->logging_function (gftp_logging_error, request->user_data,
+          request->logging_function (gftp_logging_error, request,
                                      _("Cannot look up hostname %s: %s\n"),
                                      connect_host, g_strerror (errno));
           close (sock);
@@ -1833,14 +1833,14 @@
       disphost = request->host.h_name;
       memcpy (&remote_address.sin_addr, request->host.h_addr_list[curhost],
               request->host.h_length);
-      request->logging_function (gftp_logging_misc, request->user_data,
+      request->logging_function (gftp_logging_misc, request,
                                  _("Trying %s:%d\n"),
                                  request->host.h_name, ntohs (port));
 
       if (connect (sock, (struct sockaddr *) &remote_address,
                    sizeof (remote_address)) == -1)
         {
-          request->logging_function (gftp_logging_error, request->user_data,
+          request->logging_function (gftp_logging_error, request,
                                      _("Cannot connect to %s: %s\n"),
                                      connect_host, g_strerror (errno));
         }
@@ -1857,14 +1857,14 @@
 
   if (fcntl (sock, F_SETFD, 1) == -1)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Error: Cannot set close on exec flag: %s\n"),
                                  g_strerror (errno));
 
       return (GFTP_ERETRYABLE);
     }
 
-  request->logging_function (gftp_logging_misc, request->user_data,
+  request->logging_function (gftp_logging_misc, request,
                              _("Connected to %s:%d\n"), connect_host, port);
 
   if (gftp_fd_set_sockblocking (request, sock, 1) < 0)
@@ -2079,7 +2079,7 @@
         {
           if (request != NULL)
             {
-              request->logging_function (gftp_logging_error, request->user_data,
+              request->logging_function (gftp_logging_error, request,
                                          _("Connection to %s timed out\n"),
                                          request->hostname);
               gftp_disconnect (request);
@@ -2099,7 +2099,7 @@
  
           if (request != NULL)
             {
-              request->logging_function (gftp_logging_error, request->user_data,
+              request->logging_function (gftp_logging_error, request,
                                    _("Error: Could not read from socket: %s\n"),
                                     g_strerror (errno));
               gftp_disconnect (request);
@@ -2149,7 +2149,7 @@
         {
           if (request != NULL)
             {
-              request->logging_function (gftp_logging_error, request->user_data,
+              request->logging_function (gftp_logging_error, request,
                                          _("Connection to %s timed out\n"),
                                          request->hostname);
               gftp_disconnect (request);
@@ -2169,7 +2169,7 @@
  
           if (request != NULL)
             {
-              request->logging_function (gftp_logging_error, request->user_data,
+              request->logging_function (gftp_logging_error, request,
                                     _("Error: Could not write to socket: %s\n"),
                                     g_strerror (errno));
               gftp_disconnect (request);
@@ -2217,7 +2217,7 @@
 
   if ((flags = fcntl (fd, F_GETFL, 0)) < 0)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Cannot get socket flags: %s\n"),
                                  g_strerror (errno));
       gftp_disconnect (request);
@@ -2231,7 +2231,7 @@
 
   if (fcntl (fd, F_SETFL, flags) < 0)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Cannot set socket to non-blocking: %s\n"),
                                  g_strerror (errno));
       gftp_disconnect (request);
@@ -2462,7 +2462,7 @@
   if ((fd = open (pathname, flags, mode)) < 0)
     {
       if (request != NULL)
-        request->logging_function (gftp_logging_error, request->user_data,
+        request->logging_function (gftp_logging_error, request,
                                    _("Error: Cannot open local file %s: %s\n"),
                                    pathname, g_strerror (errno));
       return (GFTP_ERETRYABLE);
@@ -2471,7 +2471,7 @@
   if (fcntl (fd, F_SETFD, 1) == -1)
     {
       if (request != NULL)
-        request->logging_function (gftp_logging_error, request->user_data,
+        request->logging_function (gftp_logging_error, request,
                                    _("Error: Cannot set close on exec flag: %s\n"),
                                    g_strerror (errno));
 
--- a/lib/rfc2068.c	Tue Jun 17 10:13:26 2003 +0000
+++ b/lib/rfc2068.c	Tue Jun 17 10:49:16 2003 +0000
@@ -77,7 +77,7 @@
 
       if (*tempstr != '\0')
         {
-          request->logging_function (gftp_logging_recv, request->user_data, "%s\n",
+          request->logging_function (gftp_logging_recv, request, "%s\n",
                                      tempstr);
 
           if (strncmp (tempstr, "Content-Length:", 15) == 0)
@@ -96,7 +96,7 @@
 
       if (sscanf ((char *) tempstr, "%lx", &params->chunk_size) != 1)
         {
-          request->logging_function (gftp_logging_recv, request->user_data,
+          request->logging_function (gftp_logging_recv, request,
                                      _("Received wrong response from server, disconnecting\n"));
           gftp_disconnect (request);
           return (GFTP_EFATAL);
@@ -109,7 +109,7 @@
 
       if (params->chunk_size < 0)
         {
-          request->logging_function (gftp_logging_recv, request->user_data, "FIXME - the chunk size is negative. aborting directory listing\n");
+          request->logging_function (gftp_logging_recv, request, "FIXME - the chunk size is negative. aborting directory listing\n");
           return (GFTP_EFATAL);
         }
 
@@ -135,7 +135,7 @@
   tempstr = g_strdup_printf ("%sUser-Agent: %s\nHost: %s\n", (char *) command,
                              gftp_version, request->hostname);
 
-  request->logging_function (gftp_logging_send, request->user_data,
+  request->logging_function (gftp_logging_send, request,
                              "%s", tempstr);
 
   ret = request->write_function (request, tempstr, strlen (tempstr), 
@@ -156,7 +156,7 @@
       str = base64_encode (tempstr);
       g_free (tempstr);
 
-      request->logging_function (gftp_logging_send, request->user_data,
+      request->logging_function (gftp_logging_send, request,
                                  "Proxy-authorization: Basic xxxx:xxxx\n");
       ret = gftp_writefmt (request, request->datafd, 
                            "Proxy-authorization: Basic %s\n", str);
@@ -171,7 +171,7 @@
       str = base64_encode (tempstr);
       g_free (tempstr);
 
-      request->logging_function (gftp_logging_send, request->user_data,
+      request->logging_function (gftp_logging_send, request,
                                  "Authorization: Basic xxxx\n");
       ret = gftp_writefmt (request, request->datafd, 
                            "Authorization: Basic %s\n", str);
@@ -238,12 +238,12 @@
 
   if (request->datafd > 0)
     {
-      request->logging_function (gftp_logging_misc, request->user_data,
+      request->logging_function (gftp_logging_misc, request,
 				 _("Disconnecting from site %s\n"),
 				 request->hostname);
 
       if (close (request->datafd) < 0)
-        request->logging_function (gftp_logging_error, request->user_data,
+        request->logging_function (gftp_logging_error, request,
                                    _("Error closing file descriptor: %s\n"),
                                    g_strerror (errno));
 
@@ -292,7 +292,7 @@
   if (use_http11 && startsize > 0)
     {
 #if defined (_LARGEFILE_SOURCE)
-      request->logging_function (gftp_logging_misc, request->user_data,
+      request->logging_function (gftp_logging_misc, request,
                               _("Starting the file transfer at offset %lld\n"),
                               startsize);
 
@@ -300,7 +300,7 @@
       tempstr = g_strdup_printf ("%sRange: bytes=%lld-\n", tempstr, startsize);
       g_free (oldstr);
 #else
-      request->logging_function (gftp_logging_misc, request->user_data,
+      request->logging_function (gftp_logging_misc, request,
 			       _("Starting the file transfer at offset %ld\n"), 
                                startsize);
 
@@ -322,7 +322,7 @@
   else if (strlen (request->last_ftp_response) < 9 ||
            strncmp (request->last_ftp_response + 9, "200", 3) != 0)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
 			         _("Cannot retrieve file %s\n"), filename);
       return (GFTP_ERETRYABLE);
     }
@@ -363,7 +363,7 @@
     return (GFTP_EFATAL);
 
   if (close (request->datafd) < 0)
-    request->logging_function (gftp_logging_error, request->user_data,
+    request->logging_function (gftp_logging_error, request,
                                _("Error closing file descriptor: %s\n"),
                                g_strerror (errno));
   request->datafd = -1;
@@ -373,7 +373,7 @@
   params->chunked_transfer = 0;
   params->chunk_size = 0;
 
-  request->logging_function (gftp_logging_misc, request->user_data,
+  request->logging_function (gftp_logging_misc, request,
                              _("Finished retrieving data\n"));
   return (0);
 }
@@ -420,7 +420,7 @@
   if (strlen (request->last_ftp_response) > 9 &&
       strncmp (request->last_ftp_response + 9, "200", 3) == 0)
     {
-      request->logging_function (gftp_logging_misc, request->user_data,
+      request->logging_function (gftp_logging_misc, request,
                                  _("Retrieving directory listing...\n"));
       return (0);
     }
@@ -714,7 +714,7 @@
         {
           if (*stpos != '\r' || *(stpos + 1) != '\n')
             {
-              request->logging_function (gftp_logging_recv, request->user_data,
+              request->logging_function (gftp_logging_recv, request,
                                          _("Received wrong response from server, disconnecting\n"));
               gftp_disconnect (request);
               return (GFTP_EFATAL);
@@ -732,7 +732,7 @@
     
           if (sscanf (stpos + 2, "%lx", &params->chunk_size) != 1)
             {
-              request->logging_function (gftp_logging_recv, request->user_data,
+              request->logging_function (gftp_logging_recv, request,
                                          _("Received wrong response from server, disconnecting\n"));
               gftp_disconnect (request);
               return (GFTP_EFATAL);
--- a/lib/rfc959.c	Tue Jun 17 10:13:26 2003 +0000
+++ b/lib/rfc959.c	Tue Jun 17 10:49:16 2003 +0000
@@ -122,7 +122,7 @@
 	  strncpy (code, tempstr, 3);
 	  code[3] = ' ';
 	}
-      request->logging_function (gftp_logging_recv, request->user_data,
+      request->logging_function (gftp_logging_recv, request,
 				 "%s\n", tempstr);
     }
   while (strncmp (code, tempstr, 4) != 0);
@@ -152,17 +152,17 @@
 
   if (strncmp (command, "PASS", 4) == 0)
     {
-      request->logging_function (gftp_logging_send, request->user_data, 
+      request->logging_function (gftp_logging_send, request, 
                                  "PASS xxxx\n");
     }
   else if (strncmp (command, "ACCT", 4) == 0)
     {
-      request->logging_function (gftp_logging_send, request->user_data, 
+      request->logging_function (gftp_logging_send, request, 
                                  "ACCT xxxx\n");
     }
   else
     {
-      request->logging_function (gftp_logging_send, request->user_data, "%s",
+      request->logging_function (gftp_logging_send, request, "%s",
                                  command);
     }
 
@@ -300,7 +300,7 @@
     return (ret);
   else if (ret != '2')
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
 				 _("Received invalid response to PWD command: '%s'\n"),
                                  request->last_ftp_response);
       gftp_disconnect (request);
@@ -309,7 +309,7 @@
 
   if ((pos = strchr (request->last_ftp_response, '"')) == NULL)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
 				 _("Received invalid response to PWD command: '%s'\n"),
                                  request->last_ftp_response);
       gftp_disconnect (request);
@@ -320,7 +320,7 @@
 
   if ((pos = strchr (dir, '"')) == NULL)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
 				 _("Received invalid response to PWD command: '%s'\n"),
                                  request->last_ftp_response);
       gftp_disconnect (request);
@@ -552,7 +552,7 @@
 
   if (request->datafd > 0)
     {
-      request->logging_function (gftp_logging_misc, request->user_data,
+      request->logging_function (gftp_logging_misc, request,
 				 _("Disconnecting from site %s\n"),
 				 request->hostname);
       close (request->datafd);
@@ -582,7 +582,7 @@
 
   if ((parms->data_connection = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
 				 _("Failed to create a socket: %s\n"),
 				 g_strerror (errno));
       gftp_disconnect (request);
@@ -591,7 +591,7 @@
 
   if (fcntl (parms->data_connection, F_SETFD, 1) == -1)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Error: Cannot set close on exec flag: %s\n"),
                                  g_strerror (errno));
 
@@ -620,7 +620,7 @@
 
       if (*pos == '\0')
         {
-          request->logging_function (gftp_logging_error, request->user_data,
+          request->logging_function (gftp_logging_error, request,
                       _("Cannot find an IP address in PASV response '%s'\n"),
                       request->last_ftp_response);
           gftp_disconnect (request);
@@ -630,7 +630,7 @@
       if (sscanf (pos, "%u,%u,%u,%u,%u,%u", &temp[0], &temp[1], &temp[2],
                   &temp[3], &temp[4], &temp[5]) != 6)
         {
-          request->logging_function (gftp_logging_error, request->user_data,
+          request->logging_function (gftp_logging_error, request,
                       _("Cannot find an IP address in PASV response '%s'\n"),
                       request->last_ftp_response);
           gftp_disconnect (request);
@@ -645,7 +645,7 @@
       if (connect (parms->data_connection, (struct sockaddr *) &data_addr, 
                    data_addr_len) == -1)
         {
-          request->logging_function (gftp_logging_error, request->user_data,
+          request->logging_function (gftp_logging_error, request,
                                     _("Cannot create a data connection: %s\n"),
                                     g_strerror (errno));
           gftp_disconnect (request);
@@ -657,7 +657,7 @@
       if (getsockname (request->datafd, (struct sockaddr *) &data_addr,
                        &data_addr_len) == -1)
         {
-	  request->logging_function (gftp_logging_error, request->user_data,
+	  request->logging_function (gftp_logging_error, request,
 				     _("Cannot get socket name: %s\n"),
 				     g_strerror (errno));
           gftp_disconnect (request);
@@ -668,7 +668,7 @@
       if (bind (parms->data_connection, (struct sockaddr *) &data_addr, 
                 data_addr_len) == -1)
 	{
-	  request->logging_function (gftp_logging_error, request->user_data,
+	  request->logging_function (gftp_logging_error, request,
 				     _("Cannot bind a port: %s\n"),
 				     g_strerror (errno));
           gftp_disconnect (request);
@@ -678,7 +678,7 @@
       if (getsockname (parms->data_connection, (struct sockaddr *) &data_addr, 
                        &data_addr_len) == -1)
         {
-	  request->logging_function (gftp_logging_error, request->user_data,
+	  request->logging_function (gftp_logging_error, request,
 				     _("Cannot get socket name: %s\n"),
 				     g_strerror (errno));
           gftp_disconnect (request);
@@ -687,7 +687,7 @@
 
       if (listen (parms->data_connection, 1) == -1)
 	{
-	  request->logging_function (gftp_logging_error, request->user_data,
+	  request->logging_function (gftp_logging_error, request,
 				     _("Cannot listen on port %d: %s\n"),
 				     ntohs (data_addr.sin_port),
 				     g_strerror (errno));
@@ -729,7 +729,7 @@
   parms = request->protocol_data;
   if ((parms->data_connection = socket (AF_INET6, SOCK_STREAM, IPPROTO_TCP)) < 0)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
 				 _("Failed to create a socket: %s\n"),
 				 g_strerror (errno));
       gftp_disconnect (request);
@@ -738,7 +738,7 @@
 
   if (fcntl (parms->data_connection, F_SETFD, 1) == -1)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Error: Cannot set close on exec flag: %s\n"),
                                  g_strerror (errno));
 
@@ -749,7 +749,7 @@
   /* This condition shouldn't happen. We better check anyway... */
   if (data_addr_len != request->hostp->ai_addrlen) 
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
 				 _("Error: It doesn't look like we are connected via IPv6. Aborting connection.\n"));
       gftp_disconnect (request);
       return (GFTP_EFATAL);
@@ -778,7 +778,7 @@
 
       if (*pos == '\0')
         {
-          request->logging_function (gftp_logging_error, request->user_data,
+          request->logging_function (gftp_logging_error, request,
                       _("Invalid EPSV response '%s'\n"),
                       request->last_ftp_response);
           gftp_disconnect (request);
@@ -787,7 +787,7 @@
 
       if (sscanf (pos, "|||%d|", &port) != 1)
         {
-          request->logging_function (gftp_logging_error, request->user_data,
+          request->logging_function (gftp_logging_error, request,
                       _("Invalid EPSV response '%s'\n"),
                       request->last_ftp_response);
           gftp_disconnect (request);
@@ -800,7 +800,7 @@
       if (connect (parms->data_connection, (struct sockaddr *) &data_addr, 
                    data_addr_len) == -1)
         {
-          request->logging_function (gftp_logging_error, request->user_data,
+          request->logging_function (gftp_logging_error, request,
                                     _("Cannot create a data connection: %s\n"),
                                     g_strerror (errno));
           gftp_disconnect (request);
@@ -815,7 +815,7 @@
       if (bind (parms->data_connection, (struct sockaddr *) &data_addr, 
                 data_addr_len) == -1)
 	{
-	  request->logging_function (gftp_logging_error, request->user_data,
+	  request->logging_function (gftp_logging_error, request,
 				     _("Cannot bind a port: %s\n"),
 				     g_strerror (errno));
           gftp_disconnect (request);
@@ -825,7 +825,7 @@
       if (getsockname (parms->data_connection, (struct sockaddr *) &data_addr, 
                        &data_addr_len) == -1)
         {
-          request->logging_function (gftp_logging_error, request->user_data,
+          request->logging_function (gftp_logging_error, request,
 				     _("Cannot get socket name: %s\n"),
 				     g_strerror (errno));
           gftp_disconnect (request);
@@ -834,7 +834,7 @@
 
       if (listen (parms->data_connection, 1) == -1)
 	{
-	  request->logging_function (gftp_logging_error, request->user_data,
+	  request->logging_function (gftp_logging_error, request,
 				     _("Cannot listen on port %d: %s\n"),
 				     ntohs (data_addr.sin6_port),
 				     g_strerror (errno));
@@ -844,7 +844,7 @@
 
       if (inet_ntop (AF_INET6, &data_addr.sin6_addr, buf, sizeof (buf)) == NULL)
         {
-          request->logging_function (gftp_logging_error, request->user_data,
+          request->logging_function (gftp_logging_error, request,
 				     _("Cannot get address of local socket: %s\n"),
 				     g_strerror (errno));
           gftp_disconnect (request);
@@ -916,7 +916,7 @@
   if ((infd = accept (parms->data_connection, (struct sockaddr *) &cli_addr,
        &cli_addr_len)) == -1)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                 _("Cannot accept connection from server: %s\n"),
                                 g_strerror (errno));
       gftp_disconnect (request);
@@ -1414,7 +1414,7 @@
 	{
 	  if (strncmp (tempstr, "total", strlen ("total")) != 0 &&
 	      strncmp (tempstr, _("total"), strlen (_("total"))) != 0)
-	    request->logging_function (gftp_logging_error, request->user_data,
+	    request->logging_function (gftp_logging_error, request,
 				       _("Warning: Cannot parse listing %s\n"),
 				       tempstr);
 	  gftp_file_destroy (fle);
--- a/lib/sshv2.c	Tue Jun 17 10:13:26 2003 +0000
+++ b/lib/sshv2.c	Tue Jun 17 10:49:16 2003 +0000
@@ -248,7 +248,7 @@
     sshv2_add_exec_args (&logstr, &logstr_len, &args, &args_len, &args_cur,
                          " %s \"%s\"", request->hostname, execname);
 
-  request->logging_function (gftp_logging_misc, request->user_data, 
+  request->logging_function (gftp_logging_misc, request, 
                              _("Running program %s\n"), logstr);
   g_free (logstr);
   return (args);
@@ -342,7 +342,7 @@
         break;
       else if (rem <= 1)
         {
-          request->logging_function (gftp_logging_recv, request->user_data,
+          request->logging_function (gftp_logging_recv, request,
                                      "%s", tempstr + lastdiff);
           len += SSH_LOGIN_BUFSIZE;
           rem += SSH_LOGIN_BUFSIZE;
@@ -355,19 +355,19 @@
   g_free (pwstr);
 
   if (*(tempstr + lastdiff) != '\0')
-    request->logging_function (gftp_logging_recv, request->user_data,
+    request->logging_function (gftp_logging_recv, request,
                                "%s\n", tempstr + lastdiff);
 
   if (ok <= 0)
     {
       if (ok == SSH_ERROR_BADPASS)
-        request->logging_function (gftp_logging_error, request->user_data,
+        request->logging_function (gftp_logging_error, request,
                                _("Error: An incorrect password was entered\n"));
       else if (ok == SSH_ERROR_QUESTION)
-        request->logging_function (gftp_logging_error, request->user_data,
+        request->logging_function (gftp_logging_error, request,
                                _("Please connect to this host with the command line SSH utility and answer this question appropriately.\n"));
       else if (ok == SSH_WARNING)
-        request->logging_function (gftp_logging_error, request->user_data,
+        request->logging_function (gftp_logging_error, request,
                                    _("Please correct the above warning to connect to this host.\n"));
 
       g_free (tempstr);
@@ -406,13 +406,13 @@
   switch (type)
     {
       case SSH_FXP_INIT:
-        request->logging_function (level, request->user_data, 
+        request->logging_function (level, request, 
                                    _("%d: Protocol Initialization\n"), id);
         break;
       case SSH_FXP_VERSION:
         memcpy (&num, message, 4);
         num = ntohl (num);
-        request->logging_function (level, request->user_data, 
+        request->logging_function (level, request, 
                                    _("%d: Protocol version %d\n"), id, num);
         break;
       case SSH_FXP_OPEN:
@@ -421,51 +421,51 @@
         pos = message + 12 + num - 1;
         oldchar = *pos;
         *pos = '\0';
-        request->logging_function (level, request->user_data,
+        request->logging_function (level, request,
                                    _("%d: Open %s\n"), id, message + 8);
         *pos = oldchar;
         break;
       case SSH_FXP_CLOSE:
-        request->logging_function (level, request->user_data, 
+        request->logging_function (level, request, 
                                    _("%d: Close\n"), id);
       case SSH_FXP_READ:
       case SSH_FXP_WRITE:
         break;  
       case SSH_FXP_OPENDIR:
-        request->logging_function (level, request->user_data, 
+        request->logging_function (level, request, 
                                    _("%d: Open Directory %s\n"), id,
                                    message + 8);
         break;
       case SSH_FXP_READDIR:
-        request->logging_function (level, request->user_data, 
+        request->logging_function (level, request, 
                                    _("%d: Read Directory\n"), id);
         break;
       case SSH_FXP_REMOVE:
-        request->logging_function (level, request->user_data, 
+        request->logging_function (level, request, 
                                    _("%d: Remove file %s\n"), id,
                                    message + 8);
         break;
       case SSH_FXP_MKDIR:
-        request->logging_function (level, request->user_data, 
+        request->logging_function (level, request, 
                                    _("%d: Make directory %s\n"), id,
                                    message + 8);
         break;
       case SSH_FXP_RMDIR:
-        request->logging_function (level, request->user_data, 
+        request->logging_function (level, request, 
                                    _("%d: Remove directory %s\n"), id,
                                    message + 8);
         break;
       case SSH_FXP_REALPATH:
-        request->logging_function (level, request->user_data, 
+        request->logging_function (level, request, 
                                    _("%d: Realpath %s\n"), id,
                                    message + 8);
         break;
       case SSH_FXP_ATTRS:
-        request->logging_function (level, request->user_data,
+        request->logging_function (level, request,
                                    _("%d: File attributes\n"), id);
         break;
       case SSH_FXP_STAT:
-        request->logging_function (level, request->user_data, 
+        request->logging_function (level, request, 
                                    _("%d: Stat %s\n"), id,
                                    message + 8);
         break;
@@ -482,12 +482,12 @@
         switch (stattype)
           {
             case SSH_FILEXFER_ATTR_PERMISSIONS:
-              request->logging_function (level, request->user_data,
+              request->logging_function (level, request,
                                          _("%d: Chmod %s %o\n"), id,
                                          message + 8, attr);
               break;
             case SSH_FILEXFER_ATTR_ACMODTIME:
-              request->logging_function (level, request->user_data,
+              request->logging_function (level, request,
                                          _("%d: Utime %s %d\n"), id,
                                          message + 8, attr);
           }
@@ -531,11 +531,11 @@
               descr = _("Unknown message returned from server");
               break;
           }
-        request->logging_function (level, request->user_data,
+        request->logging_function (level, request,
                                    "%d: %s\n", id, descr);
         break;
       case SSH_FXP_HANDLE:
-        request->logging_function (level, request->user_data, 
+        request->logging_function (level, request, 
                                    "%d: File handle\n", id);
         break;
       case SSH_FXP_DATA:
@@ -543,12 +543,12 @@
       case SSH_FXP_NAME:
         memcpy (&num, message + 4, 4);
         num = ntohl (num);
-        request->logging_function (level, request->user_data, 
+        request->logging_function (level, request, 
                                    "%d: Filenames (%d entries)\n", id,
                                    num);
         break;
       default:
-        request->logging_function (level, request->user_data, 
+        request->logging_function (level, request, 
                                    "Command: %x\n", type);
     }
 }
@@ -564,7 +564,7 @@
 
   if (len > 33995)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                              _("Error: Message size %d too big\n"), len);
       gftp_disconnect (request);
       return (GFTP_EFATAL);
@@ -616,7 +616,7 @@
   message->length = ntohl (message->length);
   if (message->length > 34000)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                              _("Error: Message size %d too big from server\n"),
                              message->length);
       memset (message, 0, sizeof (*message));
@@ -677,7 +677,7 @@
 
   if (message->end - message->pos < 4)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                      _("Received wrong response from server, disconnecting\n"));
       sshv2_message_free (message);
       gftp_disconnect (request);
@@ -690,7 +690,7 @@
 
   if (expected_response > 0 && ret != expected_response)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                      _("Received wrong response from server, disconnecting\n"));
       sshv2_message_free (message);
       gftp_disconnect (request);
@@ -712,7 +712,7 @@
 
   if (len > SSH_MAX_STRING_SIZE || (message->end - message->pos < len))
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                      _("Received wrong response from server, disconnecting\n"));
       sshv2_message_free (message);
       gftp_disconnect (request);
@@ -780,7 +780,7 @@
     }
   else if (ret != SSH_FXP_NAME)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                      _("Received wrong response from server, disconnecting\n"));
       sshv2_message_free (&message);
       gftp_disconnect (request);
@@ -826,7 +826,7 @@
   if (request->datafd > 0)
     return (0);
 
-  request->logging_function (gftp_logging_misc, request->user_data,
+  request->logging_function (gftp_logging_misc, request,
 			     _("Opening SSH connection to %s\n"),
                              request->hostname);
 
@@ -855,7 +855,7 @@
     {
       if (!r_getservbyname ("ssh", "tcp", &serv_struct, NULL))
         {
-         request->logging_function (gftp_logging_error, request->user_data,
+         request->logging_function (gftp_logging_error, request,
                                     _("Cannot look up service name %s/tcp. Please check your services file\n"),
                                     "ssh");
         }
@@ -870,7 +870,7 @@
     {
       if (socketpair (AF_LOCAL, SOCK_STREAM, 0, s) < 0)
         {
-          request->logging_function (gftp_logging_error, request->user_data,
+          request->logging_function (gftp_logging_error, request,
                                      _("Cannot create a socket pair: %s\n"),
                                      g_strerror (errno));
           return (GFTP_ERETRYABLE);
@@ -927,7 +927,7 @@
       memset (&message, 0, sizeof (message));
       if ((ret = sshv2_read_response (request, &message, -1)) != SSH_FXP_VERSION)
         {
-          request->logging_function (gftp_logging_error, request->user_data,
+          request->logging_function (gftp_logging_error, request,
                    _("Received wrong response from server, disconnecting\n"));
           sshv2_message_free (&message);
           gftp_disconnect (request);
@@ -939,13 +939,13 @@
         }
       sshv2_message_free (&message);
 
-      request->logging_function (gftp_logging_misc, request->user_data,
+      request->logging_function (gftp_logging_misc, request,
 			         _("Successfully logged into SSH server %s\n"),
                                  request->hostname);
     }
   else
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Cannot fork another process: %s\n"),
                                  g_strerror (errno));
       g_free (args);
@@ -981,12 +981,12 @@
 
   if (request->datafd > 0)
     {
-      request->logging_function (gftp_logging_misc, request->user_data,
+      request->logging_function (gftp_logging_misc, request,
 			         _("Disconnecting from site %s\n"),
                                  request->hostname);
 
       if (close (request->datafd) < 0)
-        request->logging_function (gftp_logging_error, request->user_data,
+        request->logging_function (gftp_logging_error, request,
                                    _("Error closing file descriptor: %s\n"),
                                    g_strerror (errno));
 
@@ -1028,7 +1028,7 @@
       memset (&message, 0, sizeof (message));
       if ((ret = sshv2_read_response (request, &message, -1)) != SSH_FXP_STATUS)
         {
-          request->logging_function (gftp_logging_error, request->user_data,
+          request->logging_function (gftp_logging_error, request,
                      _("Received wrong response from server, disconnecting\n"));
           sshv2_message_free (&message);
           gftp_disconnect (request);
@@ -1066,7 +1066,7 @@
 
   params = request->protocol_data;
 
-  request->logging_function (gftp_logging_misc, request->user_data,
+  request->logging_function (gftp_logging_misc, request,
 			     _("Retrieving directory listing...\n"));
 
   tempstr = g_malloc (strlen (request->directory) + 9);
@@ -1096,7 +1096,7 @@
     }
   else if (ret != SSH_FXP_HANDLE)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                      _("Received wrong response from server, disconnecting\n"));
       sshv2_message_free (&message);
       gftp_disconnect (request);
@@ -1105,7 +1105,7 @@
 
   if (message.length - 4 > SSH_MAX_HANDLE_SIZE)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                              _("Error: Message size %d too big from server\n"),
                              message.length - 4);
       sshv2_message_free (&message);
@@ -1210,7 +1210,7 @@
           params->message.pos += 8;
           if (params->message.pos > params->message.end)
             {
-              request->logging_function (gftp_logging_error, request->user_data,
+              request->logging_function (gftp_logging_error, request,
                      _("Received wrong response from server, disconnecting\n"));
               sshv2_message_free (&params->message);
               gftp_disconnect (request);
@@ -1223,7 +1223,7 @@
           params->message.pos += 8;
           if (params->message.pos > params->message.end)
             {
-              request->logging_function (gftp_logging_error, request->user_data,
+              request->logging_function (gftp_logging_error, request,
                      _("Received wrong response from server, disconnecting\n"));
               sshv2_message_free (&params->message);
               gftp_disconnect (request);
@@ -1236,7 +1236,7 @@
           params->message.pos += 4;
           if (params->message.pos > params->message.end)
             {
-              request->logging_function (gftp_logging_error, request->user_data,
+              request->logging_function (gftp_logging_error, request,
                      _("Received wrong response from server, disconnecting\n"));
               sshv2_message_free (&params->message);
               gftp_disconnect (request);
@@ -1249,7 +1249,7 @@
           params->message.pos += 8;
           if (params->message.pos > params->message.end)
             {
-              request->logging_function (gftp_logging_error, request->user_data,
+              request->logging_function (gftp_logging_error, request,
                      _("Received wrong response from server, disconnecting\n"));
               sshv2_message_free (&params->message);
               gftp_disconnect (request);
@@ -1305,7 +1305,7 @@
     }
   else
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                      _("Received wrong response from server, disconnecting\n"));
       sshv2_message_free (&params->message);
       gftp_disconnect (request);
@@ -1370,7 +1370,7 @@
         }
       else if (ret != SSH_FXP_NAME)
         {
-          request->logging_function (gftp_logging_error, request->user_data,
+          request->logging_function (gftp_logging_error, request,
                      _("Received wrong response from server, disconnecting\n"));
           sshv2_message_free (&message);
           gftp_disconnect (request);
@@ -1830,7 +1830,7 @@
     }
   else if (serv_ret != SSH_FXP_ATTRS)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                      _("Received wrong response from server, disconnecting\n"));
       sshv2_message_free (&params->message);
       gftp_disconnect (request);
@@ -1932,7 +1932,7 @@
     }
   else if (ret != SSH_FXP_HANDLE)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                      _("Received wrong response from server, disconnecting\n"));
       sshv2_message_free (&message);
       gftp_disconnect (request);
@@ -1941,7 +1941,7 @@
 
   if (message.length - 4 > SSH_MAX_HANDLE_SIZE)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                              _("Error: Message size %d too big from server\n"),
                              message.length - 4);
       sshv2_message_free (&message);
@@ -2025,7 +2025,7 @@
     }
   else if (ret != SSH_FXP_HANDLE)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                      _("Received wrong response from server, disconnecting\n"));
       sshv2_message_free (&message);
       gftp_disconnect (request);
@@ -2034,7 +2034,7 @@
 
   if (message.length - 4 > SSH_MAX_HANDLE_SIZE)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                              _("Error: Message size %d too big from server\n"),
                              message.length - 4);
       sshv2_message_free (&message);
@@ -2110,7 +2110,7 @@
       sshv2_message_free (&message);
       if (num != SSH_FX_EOF)
         {
-          request->logging_function (gftp_logging_error, request->user_data,
+          request->logging_function (gftp_logging_error, request,
                      _("Received wrong response from server, disconnecting\n"));
           gftp_disconnect (request);
           return (GFTP_ERETRYABLE);
@@ -2122,7 +2122,7 @@
   num = ntohl (num);
   if (num > size)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                              _("Error: Message size %d too big from server\n"),
                              num);
       sshv2_message_free (&message);
@@ -2195,7 +2195,7 @@
   params->dont_log_status = 0;
   if (ret != SSH_FXP_STATUS)
    {
-     request->logging_function (gftp_logging_error, request->user_data,
+     request->logging_function (gftp_logging_error, request,
                      _("Received wrong response from server, disconnecting\n"));
      sshv2_message_free (&message);
      gftp_disconnect (request);
--- a/lib/sslcommon.c	Tue Jun 17 10:13:26 2003 +0000
+++ b/lib/sslcommon.c	Tue Jun 17 10:49:16 2003 +0000
@@ -90,8 +90,8 @@
 
       X509_NAME_oneline (X509_get_issuer_name (cert), issuer, sizeof (issuer));
       X509_NAME_oneline (X509_get_subject_name (cert), subject, sizeof (subject));
-      request->logging_function (gftp_logging_error, request->user_data,
-                                 "Error with certificate at depth: %i\nIssuer = %s\nSubject = %s\nError %i:%s\n", 
+      request->logging_function (gftp_logging_error, request,
+                                 _("Error with certificate at depth: %i\nIssuer = %s\nSubject = %s\nError %i:%s\n"),
                                  depth, issuer, subject, err, 
                                  X509_verify_cert_error_string (err));
     }
@@ -112,7 +112,7 @@
   ok = 0;
   if (!(cert = SSL_get_peer_certificate (request->ssl)))
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Cannot get peer certificate\n"));
       return (X509_V_ERR_APPLICATION_VERIFICATION);
     }
@@ -168,7 +168,7 @@
      data[sizeof (data) - 1] = '\0';
      if (strcasecmp (data, request->hostname) != 0)
        {
-         request->logging_function (gftp_logging_error, request->user_data,
+         request->logging_function (gftp_logging_error, request,
                                     _("The SSL certificate's host %s does not match the host %s that we connected to\n"),
                                     data, request->hostname);
          X509_free (cert);
@@ -196,7 +196,7 @@
   /* FIXME _ thread setup */
   if (!SSL_library_init ())
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Cannot initialized the OpenSSL library\n"));
       return (GFTP_EFATAL);
     }
@@ -211,7 +211,7 @@
 
   if (SSL_CTX_set_default_verify_paths (ctx) != 1)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Error loading default SSL certificates\n"));
       return (GFTP_EFATAL);
     }
@@ -222,7 +222,7 @@
 
   if (SSL_CTX_set_cipher_list (ctx, "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH") != 1)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Error setting cipher list (no valid ciphers)\n"));
       return (GFTP_EFATAL);
     }
@@ -241,7 +241,7 @@
 
   if (!gftp_ssl_initialized)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Error: SSL engine was not initialized\n"));
       return (GFTP_EFATAL);
     }
@@ -254,7 +254,7 @@
 
   if ((bio = BIO_new (BIO_s_socket ())) == NULL)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Error setting up SSL connection (BIO object)\n"));
       return (GFTP_EFATAL);
     }
@@ -263,7 +263,7 @@
 
   if ((request->ssl = SSL_new (ctx)) == NULL)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Error setting up SSL connection (SSL object)\n"));
       return (GFTP_EFATAL);
     }
@@ -276,13 +276,13 @@
 
   if ((ret = gftp_ssl_post_connection_check (request)) != X509_V_OK)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Error with peer certificate: %s\n"),
                                  X509_verify_cert_error_string (ret));
       return (GFTP_EFATAL);
     }
 
-  request->logging_function (gftp_logging_misc, request->user_data,
+  request->logging_function (gftp_logging_misc, request,
                              "SSL connection established using %s (%s)\n", 
                              SSL_get_cipher_version (request->ssl), 
                              SSL_get_cipher_name (request->ssl));
@@ -299,7 +299,7 @@
 
   if (!gftp_ssl_initialized)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Error: SSL engine was not initialized\n"));
       return (GFTP_EFATAL);
     }
@@ -322,7 +322,7 @@
  
           if (request != NULL)
             {
-              request->logging_function (gftp_logging_error, request->user_data,
+              request->logging_function (gftp_logging_error, request,
                                    _("Error: Could not read from socket: %s\n"),
                                     g_strerror (errno));
               gftp_disconnect (request);
@@ -349,7 +349,7 @@
  
   if (!gftp_ssl_initialized)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Error: SSL engine was not initialized\n"));
       return (GFTP_EFATAL);
     }
@@ -370,7 +370,7 @@
  
           if (request != NULL)
             {
-              request->logging_function (gftp_logging_error, request->user_data,
+              request->logging_function (gftp_logging_error, request,
                                     _("Error: Could not write to socket: %s\n"),
                                     g_strerror (errno));
               gftp_disconnect (request);
--- a/src/gtk/chmod_dialog.c	Tue Jun 17 10:13:26 2003 +0000
+++ b/src/gtk/chmod_dialog.c	Tue Jun 17 10:49:16 2003 +0000
@@ -69,7 +69,7 @@
     {
       gftp_disconnect (wdata->request);
       wdata->request->logging_function (gftp_logging_error, 
-                                        wdata->request->user_data,
+                                        wdata->request,
                                         _("Operation canceled\n"));
     }
 
--- a/src/gtk/delete_dialog.c	Tue Jun 17 10:13:26 2003 +0000
+++ b/src/gtk/delete_dialog.c	Tue Jun 17 10:49:16 2003 +0000
@@ -86,7 +86,7 @@
     {
       gftp_disconnect (transfer->fromreq);
       transfer->fromreq->logging_function (gftp_logging_error,
-                                        transfer->fromreq->user_data,
+                                        transfer->fromreq,
                                         _("Operation canceled\n"));
     }
 
--- a/src/gtk/gftp-gtk.h	Tue Jun 17 10:13:26 2003 +0000
+++ b/src/gtk/gftp-gtk.h	Tue Jun 17 10:49:16 2003 +0000
@@ -275,7 +275,7 @@
 void remove_files_window			( gftp_window_data * wdata );
 
 void ftp_log					( gftp_logging_level level,
-						  void *ptr,
+						  gftp_request * request,
 						  const char *string,
 						  ... );
 
--- a/src/gtk/menu-items.c	Tue Jun 17 10:13:26 2003 +0000
+++ b/src/gtk/menu-items.c	Tue Jun 17 10:49:16 2003 +0000
@@ -426,7 +426,7 @@
     {
       gftp_disconnect (wdata->request);
       wdata->request->logging_function (gftp_logging_error,
-                                        wdata->request->user_data,
+                                        wdata->request,
                                         _("Operation canceled\n"));
     }
 
@@ -616,7 +616,9 @@
     {
       if ((len = write (fd, pos, textlen)) == -1)
         { 
-          ftp_log (gftp_logging_misc, NULL, _("Error: Error writing to %s: %s\n"), tempstr, g_strerror (errno));
+          ftp_log (gftp_logging_misc, NULL, 
+                   _("Error: Error writing to %s: %s\n"), 
+                   tempstr, g_strerror (errno));
           break;
         }
       textlen -= len;
@@ -672,7 +674,9 @@
       if ((len = write (fileno (fd), pos, textlen)) == -1)
         {
           ok = 0;
-          ftp_log (gftp_logging_misc, NULL, _("Error: Error writing to %s: %s\n"), filename, g_strerror (errno));
+          ftp_log (gftp_logging_misc, NULL, 
+                   _("Error: Error writing to %s: %s\n"), 
+                   filename, g_strerror (errno));
           break;
         }
 
--- a/src/gtk/misc-gtk.c	Tue Jun 17 10:13:26 2003 +0000
+++ b/src/gtk/misc-gtk.c	Tue Jun 17 10:49:16 2003 +0000
@@ -36,7 +36,8 @@
 
 
 void
-ftp_log (gftp_logging_level level, void *ptr, const char *string, ...)
+ftp_log (gftp_logging_level level, gftp_request * request, 
+         const char *string, ...)
 {
   guint max_log_window_size;
   int upd, free_logstr;
@@ -49,11 +50,10 @@
   gftp_color * color;
   GdkColor fore;
 #else
+  char *utf8_str;
   GtkTextBuffer * textbuf;
   GtkTextIter iter, iter2;
-  gsize bread, bwrite;
   const char *descr;
-  char *tempstr;
 #endif
 
   if (pthread_self () != main_thread_id)
@@ -83,6 +83,21 @@
     }
   va_end (argp);
 
+#if GTK_MAJOR_VERSION > 1
+  if (!g_utf8_validate (logstr, -1, NULL))
+    {
+      if ((utf8_str = gftp_string_to_utf8 (request, logstr)) != NULL)
+        {
+          if (free_logstr)
+            g_free (logstr);
+          else
+            free_logstr = 1;
+
+          logstr = utf8_str;
+        }
+    }
+#endif
+
   if (gftp_logfd != NULL)
     {
       if (fwrite (logstr, strlen (logstr), 1, gftp_logfd) != 1)
@@ -161,20 +176,6 @@
         break;
     }
 
-  /* If the current log message is not in UTF8 format, convert it to UTF8 
-     format based on the current locale */
-  if (!g_utf8_validate (logstr, -1, NULL))
-    {
-      tempstr = g_locale_to_utf8 (logstr, -1, &bread, &bwrite, NULL);
-      if (tempstr != NULL)
-        {
-          if (free_logstr)
-            g_free (logstr);
-          logstr = tempstr;
-          free_logstr = 1;
-        }
-    }
-
   textbuf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (logwdw));
   len = gtk_text_buffer_get_char_count (textbuf);
   gtk_text_buffer_get_iter_at_offset (textbuf, &iter, len);
@@ -1251,7 +1252,7 @@
   while (templist != NULL)
     { 
       templog = (gftp_log *) templist->data;
-      ftp_log (templog->type, (void *) 0x2, "%s", templog->msg);
+      ftp_log (templog->type, NULL, "%s", templog->msg);
       g_free (templog->msg);
       g_free (templog); 
       templist->data = NULL;
--- a/src/gtk/mkdir_dialog.c	Tue Jun 17 10:13:26 2003 +0000
+++ b/src/gtk/mkdir_dialog.c	Tue Jun 17 10:49:16 2003 +0000
@@ -54,7 +54,7 @@
     {
       gftp_disconnect (wdata->request);
       wdata->request->logging_function (gftp_logging_error,
-                                        wdata->request->user_data,
+                                        wdata->request,
                                         _("Operation canceled\n"));
     }
 
--- a/src/gtk/rename_dialog.c	Tue Jun 17 10:13:26 2003 +0000
+++ b/src/gtk/rename_dialog.c	Tue Jun 17 10:49:16 2003 +0000
@@ -55,7 +55,7 @@
     {
       gftp_disconnect (wdata->request);
       wdata->request->logging_function (gftp_logging_error,
-                                        wdata->request->user_data,
+                                        wdata->request,
                                         _("Operation canceled\n"));
     }
 
--- a/src/gtk/transfer.c	Tue Jun 17 10:13:26 2003 +0000
+++ b/src/gtk/transfer.c	Tue Jun 17 10:49:16 2003 +0000
@@ -278,7 +278,7 @@
         }
       else if (retries == 0 || conn_num < retries)
         {
-          request->logging_function (gftp_logging_misc, request->user_data,
+          request->logging_function (gftp_logging_misc, request,
                      _("Waiting %d seconds until trying to connect again\n"),
 		     sleep_time);
           alarm (sleep_time);
@@ -528,7 +528,7 @@
       if (transfer->toreq)
         gftp_disconnect (transfer->toreq);
       transfer->fromreq->logging_function (gftp_logging_error,
-                                           transfer->fromreq->user_data,
+                                           transfer->fromreq,
                                            _("Operation canceled\n"));
     }
 
@@ -640,7 +640,7 @@
           !GFTP_IS_CONNECTED (transfer->toreq))
         {
           transfer->fromreq->logging_function (gftp_logging_misc, 
-                         transfer->fromreq->user_data, 
+                         transfer->fromreq, 
                          _("Error: Remote site disconnected after trying to transfer file\n"));
         }
       else if (fromsize < 0)
@@ -697,7 +697,7 @@
       else if (num_read < 0)
         {
           transfer->fromreq->logging_function (gftp_logging_misc, 
-                                        transfer->fromreq->user_data, 
+                                        transfer->fromreq, 
                                         _("Could not download %s from %s\n"), 
                                         curfle->file,
                                         transfer->fromreq->hostname);
@@ -727,7 +727,7 @@
           gftp_end_transfer (transfer->toreq);
 
           transfer->fromreq->logging_function (gftp_logging_misc, 
-                         transfer->fromreq->user_data, 
+                         transfer->fromreq, 
                          _("Successfully transferred %s at %.2f KB/s\n"),
                          curfle->file, transfer->kbs);
         }
--- a/src/text/gftp-text.c	Tue Jun 17 10:13:26 2003 +0000
+++ b/src/text/gftp-text.c	Tue Jun 17 10:49:16 2003 +0000
@@ -248,9 +248,10 @@
 
 
 void
-gftp_text_log (gftp_logging_level level, void *ptr, const char *string, ...)
+gftp_text_log (gftp_logging_level level, gftp_request * request, 
+               const char *string, ...)
 {
-  char tempstr[512], *stpos, *endpos;
+  char tempstr[512], *stpos, *endpos, *utf8_str = NULL, *outstr;
   va_list argp;
   int sw;
 
@@ -276,9 +277,19 @@
   g_vsnprintf (tempstr, sizeof (tempstr), string, argp);
   va_end (argp);
 
+#if GLIB_MAJOR_VERSION > 1
+  if (!g_utf8_validate (tempstr, -1, NULL))
+    utf8_str = gftp_string_to_utf8 (request, tempstr);
+#endif
+
+  if (utf8_str != NULL)
+    outstr = utf8_str;
+  else
+    outstr = tempstr;
+
   if (gftp_logfd != NULL)
     {
-      fwrite (tempstr, 1, strlen (tempstr), gftp_logfd);
+      fwrite (outstr, 1, strlen (outstr), gftp_logfd);
       if (ferror (gftp_logfd))
         {
           fclose (gftp_logfd);
@@ -289,8 +300,8 @@
     }
 
   sw = gftp_text_get_win_size ();
-  stpos = tempstr;
-  endpos = tempstr + 1;
+  stpos = outstr;
+  endpos = outstr + 1;
   do
     {
       if (strlen (stpos) <= sw)
@@ -309,6 +320,9 @@
   while (stpos != endpos);
   
   printf ("%s", COLOR_DEFAULT);
+
+  if (utf8_str != NULL)
+    g_free (utf8_str);
 }
 
 
@@ -324,7 +338,7 @@
 
   if (*command == '\0')
     {
-      gftp_text_log (gftp_logging_error, NULL,
+      gftp_text_log (gftp_logging_error, request,
           _("usage: open [[ftp://][user:pass@]ftp-site[:port][/directory]]\n"));
       return (1);
     }
@@ -373,13 +387,13 @@
 {
   char *str;
 
-  gftp_text_log (gftp_logging_misc, NULL,
+  gftp_text_log (gftp_logging_misc, request,
       "%s. Copyright (C) 1998-2003 Brian Masney <masneyb@gftp.org>\n", 
       gftp_version);
 
   str = _("Translated by");
   if (strcmp (str, "Translated by") != 0)
-    gftp_text_log (gftp_logging_misc, NULL, "%s\n", str);
+    gftp_text_log (gftp_logging_misc, request, "%s\n", str);
   return (1);
 }
 
@@ -399,11 +413,11 @@
 {
   if (!GFTP_IS_CONNECTED (request))
     {
-      gftp_text_log (gftp_logging_error, NULL,
+      gftp_text_log (gftp_logging_error, request,
                      _("Error: Not connected to a remote site\n"));
       return (1);
     }
-  gftp_text_log (gftp_logging_misc, NULL, "%s\n", request->directory);
+  gftp_text_log (gftp_logging_misc, request, "%s\n", request->directory);
   return (1);
 }
 
@@ -415,19 +429,21 @@
 
   if (!GFTP_IS_CONNECTED (request))
     {
-      gftp_text_log (gftp_logging_error, NULL,
+      gftp_text_log (gftp_logging_error, request,
                      _("Error: Not connected to a remote site\n"));
       return (1);
     }
   else if (*command == '\0')
     {
-      gftp_text_log (gftp_logging_error, NULL, _("usage: chdir <directory>\n"));
+      gftp_text_log (gftp_logging_error, request, 
+                     _("usage: chdir <directory>\n"));
       return (1);
     }
   else if (request->protonum == GFTP_LOCAL_NUM &&
            (newdir = expand_path (command)) == NULL)
     {
-      gftp_text_log (gftp_logging_error, NULL, _("usage: chdir <directory>\n"));
+      gftp_text_log (gftp_logging_error, request, 
+                     _("usage: chdir <directory>\n"));
       return (1);
     }
 
@@ -445,14 +461,14 @@
 {
   if (!GFTP_IS_CONNECTED (request))
     {
-      gftp_text_log (gftp_logging_error, NULL,
+      gftp_text_log (gftp_logging_error, request,
                      _("Error: Not connected to a remote site\n"));
       return (1);
     }
 
   if (*command == '\0')
     {
-      gftp_text_log (gftp_logging_error, NULL,
+      gftp_text_log (gftp_logging_error, request,
                      _("usage: mkdir <new directory>\n"));
     }
   else
@@ -468,14 +484,15 @@
 {
   if (!GFTP_IS_CONNECTED (request))
     {
-      gftp_text_log (gftp_logging_error, NULL, 
+      gftp_text_log (gftp_logging_error, request, 
                      _("Error: Not connected to a remote site\n"));
       return (1);
     }
 
   if (*command == '\0')
     {
-      gftp_text_log (gftp_logging_error, NULL, _("usage: rmdir <directory>\n"));
+      gftp_text_log (gftp_logging_error, request, 
+                     _("usage: rmdir <directory>\n"));
     }
   else
     {
@@ -490,14 +507,15 @@
 {
   if (!GFTP_IS_CONNECTED (request))
     {
-      gftp_text_log (gftp_logging_error, NULL,
+      gftp_text_log (gftp_logging_error, request,
                      _("Error: Not connected to a remote site\n"));
       return (1);
     }
 
   if (*command == '\0')
     {
-      gftp_text_log (gftp_logging_error, NULL,_("usage: delete <file>\n"));
+      gftp_text_log (gftp_logging_error, request,
+                     _("usage: delete <file>\n"));
     }
   else
     {
@@ -515,7 +533,7 @@
 
   if (!GFTP_IS_CONNECTED (request))
     {
-      gftp_text_log (gftp_logging_error, NULL,
+      gftp_text_log (gftp_logging_error, request,
                      _("Error: Not connected to a remote site\n"));
       return (1);
     }
@@ -525,7 +543,7 @@
 
   if (*command == '\0' || pos == NULL || *pos == '\0')
     {
-      gftp_text_log (gftp_logging_error, NULL,
+      gftp_text_log (gftp_logging_error, request,
                      _("usage: rename <old name> <new name>\n"));
     }
   else
@@ -543,7 +561,7 @@
 
   if (!GFTP_IS_CONNECTED (request))
     {
-      gftp_text_log (gftp_logging_error, NULL,
+      gftp_text_log (gftp_logging_error, request,
                      _("Error: Not connected to a remote site\n"));
       return (1);
     }
@@ -553,7 +571,7 @@
 
   if (*command == '\0' || pos == NULL || *pos == '\0')
     {
-      gftp_text_log (gftp_logging_error, NULL,
+      gftp_text_log (gftp_logging_error, request,
                      _("usage: chmod <mode> <file>\n"));
     }
   else
@@ -576,7 +594,7 @@
   time (&curtime);
   if (!GFTP_IS_CONNECTED (request))
     {
-      gftp_text_log (gftp_logging_error, NULL,
+      gftp_text_log (gftp_logging_error, request,
                      _("Error: Not connected to a remote site\n"));
       return (1);
     }
@@ -664,7 +682,7 @@
 {
   if (!GFTP_IS_CONNECTED (gftp_text_remreq))
     {
-      gftp_text_log (gftp_logging_error, NULL,
+      gftp_text_log (gftp_logging_error, request,
                      _("Error: Not connected to a remote site\n"));
       return (1);
     }
@@ -682,7 +700,7 @@
 {
   if (!GFTP_IS_CONNECTED (gftp_text_remreq))
     {
-      gftp_text_log (gftp_logging_error, NULL,
+      gftp_text_log (gftp_logging_error, request,
                      _("Error: Not connected to a remote site\n"));
       return (1);
     }
@@ -703,14 +721,15 @@
 
   if (!GFTP_IS_CONNECTED (gftp_text_remreq))
     {
-      gftp_text_log (gftp_logging_error, NULL,
+      gftp_text_log (gftp_logging_error, request,
                      _("Error: Not connected to a remote site\n"));
       return (1);
     }
 
   if (*command == '\0')
     {
-      gftp_text_log (gftp_logging_error, NULL, _("usage: mget <filespec>\n"));
+      gftp_text_log (gftp_logging_error, request, 
+                     _("usage: mget <filespec>\n"));
       return (1);
     }
 
@@ -776,14 +795,15 @@
 
   if (!GFTP_IS_CONNECTED (gftp_text_remreq))
     {
-      gftp_text_log (gftp_logging_error, NULL,
+      gftp_text_log (gftp_logging_error, request,
                      _("Error: Not connected to a remote site\n"));
       return (1);
     }
 
   if (*command == '\0')
     {
-      gftp_text_log (gftp_logging_error, NULL, _("usage: mput <filespec>\n"));
+      gftp_text_log (gftp_logging_error, request, 
+                     _("usage: mput <filespec>\n"));
       return (1);
     }
 
@@ -920,14 +940,14 @@
 
       if (num_read < 0)
         {
-          gftp_text_log (gftp_logging_misc, NULL, 
+          gftp_text_log (gftp_logging_misc, transfer->fromreq, 
                          _("Could not download %s\n"), curfle->file);
           gftp_disconnect (transfer->fromreq);
           gftp_disconnect (transfer->toreq);
         }
       else
         {
-          gftp_text_log (gftp_logging_misc, NULL, 
+          gftp_text_log (gftp_logging_misc, transfer->fromreq, 
                          _("Successfully transferred %s\n"), curfle->file);
           gftp_end_transfer (transfer->fromreq);
           gftp_end_transfer (transfer->toreq);
@@ -1050,7 +1070,7 @@
     {
       if ((pos = strchr (command, '=')) == NULL)
         {
-          gftp_text_log (gftp_logging_error, NULL,
+          gftp_text_log (gftp_logging_error, request,
                          _("usage: set [variable = value]\n"));
           return (1);
         }
@@ -1064,14 +1084,14 @@
 
       if ((cv = g_hash_table_lookup (gftp_global_options_htable, command)) == NULL)
         {
-          gftp_text_log (gftp_logging_error, NULL,
+          gftp_text_log (gftp_logging_error, request,
                          _("Error: Variable %s is not a valid configuration variable.\n"), command);
           return (1);
         }
 
       if (!(cv->ports_shown & GFTP_PORT_TEXT))
         {
-          gftp_text_log (gftp_logging_error, NULL,
+          gftp_text_log (gftp_logging_error, request,
                          _("Error: Variable %s is not available in the text port of gFTP\n"), command);
           return (1);
         }
@@ -1093,7 +1113,7 @@
   if (strcasecmp (command, "cache") == 0)
     gftp_clear_cache_files ();
   else
-    gftp_text_log (gftp_logging_error, NULL, "Invalid argument\n");
+    gftp_text_log (gftp_logging_error, request, _("Invalid argument\n"));
   return (1);
 }
 
@@ -1118,7 +1138,7 @@
         {
           
           gftp_text_log (gftp_logging_error, NULL, 
-                         "Cannot open controlling terminal %s\n", termname);
+                         _("Cannot open controlling terminal %s\n"), termname);
           return (NULL);
         }
       outfd = infd;
--- a/src/text/gftp-text.h	Tue Jun 17 10:13:26 2003 +0000
+++ b/src/text/gftp-text.h	Tue Jun 17 10:49:16 2003 +0000
@@ -52,7 +52,7 @@
 
 /* gftp-text.h */
 void gftp_text_log				( gftp_logging_level level, 
-						  void *ptr, 
+						  gftp_request * request, 
 						  const char *string, ... );
 int gftp_text_open				( gftp_request * request, 
 						  char *command,