]> git.street.me.uk Git - andy/viking.git/blobdiff - src/curl_download.c
add copyright in dem files
[andy/viking.git] / src / curl_download.c
index 9fa52c682f67dd5934995f8e45c1613cb80500a1..4e38aafd32b5bdbe029b7c8abf22bfa02ac57d80 100644 (file)
@@ -25,6 +25,7 @@
 #include "config.h"
 #endif
 
+#include <glib/gi18n.h>
 #include <gtk/gtk.h>
 
 #include <curl/curl.h>
@@ -58,7 +59,7 @@ static gchar *get_cookie_file(gboolean init)
     curl_easy_setopt(curl, CURLOPT_COOKIEJAR, cookie_file);
     res = curl_easy_perform(curl);
     if (res != CURLE_OK) {
-      g_warning("%s() Curl perform failed: %s\n", __PRETTY_FUNCTION__,
+      g_warning(_("%s() Curl perform failed: %s"), __PRETTY_FUNCTION__,
           curl_easy_strerror(res));
       unlink(cookie_file);
     }
@@ -95,7 +96,7 @@ int curl_download_uri ( const char *uri, FILE *f, DownloadOptions *options )
           curl_easy_setopt ( curl, CURLOPT_MAXREDIRS, options->follow_location);
         }
       }
-      curl_easy_setopt ( curl, CURLOPT_USERAGENT, "viking/" VERSION " libcurl/7.15.4" );
+      curl_easy_setopt ( curl, CURLOPT_USERAGENT, PACKAGE "/" VERSION " libcurl/7.15.4" );
       if ((cookie_file = get_cookie_file(FALSE)) != NULL)
         curl_easy_setopt(curl, CURLOPT_COOKIEFILE, cookie_file);
       res = curl_easy_perform ( curl );
@@ -104,13 +105,13 @@ int curl_download_uri ( const char *uri, FILE *f, DownloadOptions *options )
   return(res);
 }
 
-int curl_download_get_url ( const char *hostname, const char *uri, FILE *f, DownloadOptions *options )
+int curl_download_get_url ( const char *hostname, const char *uri, FILE *f, DownloadOptions *options, gboolean ftp )
 {
   int ret;
   gchar *full = NULL;
 
   /* Compose the full url */
-  full = g_strdup_printf ( "http://%s%s", hostname, uri );
+  full = g_strdup_printf ( "%s://%s%s", (ftp?"ftp":"http"), hostname, uri );
   ret = curl_download_uri ( full, f, options );
   g_free ( full );
   full = NULL;