RSSyl: Allow use of .netrc by libcurl. Bug/enhancement #3309, by Vincent Pelletier
[claws.git] / src / plugins / libravatar / libravatar.c
index 9f225bba184b9274910bd193730ada69da9336ce..54227ed09e6c2b0577393c6bb6caf505967e80d2 100644 (file)
@@ -70,6 +70,7 @@ static gboolean libravatar_header_update_hook(gpointer source, gpointer data)
 
                debug_print("libravatar added '%s'\n", a);
                procmsg_msginfo_add_avatar(acd->msginfo, AVATAR_LIBRAVATAR, a);
+               g_free(a);
        }
 
        return FALSE; /* keep getting */
@@ -159,7 +160,13 @@ static GtkWidget *image_widget_from_url(const gchar *url, const gchar *md5)
        }
        curl_easy_setopt(curl, CURLOPT_URL, url);
        curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_image_data_cb);
-       curl_easy_setopt(curl, CURLOPT_TIMEOUT, prefs_common_get_prefs()->io_timeout_secs);
+       /* make sure timeout is less than general IO timeout */
+       curl_easy_setopt(curl, CURLOPT_TIMEOUT,
+                       (libravatarprefs.timeout == 0
+                               || libravatarprefs.timeout
+                                       > prefs_common_get_prefs()->io_timeout_secs)
+                       ? prefs_common_get_prefs()->io_timeout_secs
+                       : libravatarprefs.timeout);
        curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
 
        filename = cache_name_for_md5(md5);
@@ -193,7 +200,7 @@ static GtkWidget *image_widget_from_url(const gchar *url, const gchar *md5)
                if (filesize == 0)
                        missing_add_md5(libravatarmisses, md5);
        } else {
-               g_warning("could not open '%s' for writting\n", filename);
+               g_warning("could not open '%s' for writing\n", filename);
        }
        curl_easy_cleanup(curl);
        g_free(filename);
@@ -456,7 +463,7 @@ const gchar *plugin_desc(void)
                 "info about libravatar at http://www.libravatar.org/. If you have\n"
                 "a gravatar.com profile but not a libravatar one, those will also\n"
                 "be retrieved (when redirections are allowed in plugin config).\n"
-                "Plugin config page it's available from main window at:\n"
+                "Plugin config page is available from main window at:\n"
                 "/Configuration/Preferences/Plugins/Libravatar.\n\n"
                 "This plugin uses libcurl to retrieve images, so if you're behind a\n"
                 "proxy please refer to curl(1) manpage for details on 'http_proxy'\n"