1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-01 07:16:37 +02:00

core: add option weechat.network.proxy_curl (task #12651)

This commit is contained in:
Sebastien Helleu
2013-06-08 19:25:56 +02:00
parent 21e51d930d
commit c962bb32f9
20 changed files with 284 additions and 14 deletions
+1
View File
@@ -14,6 +14,7 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
Version 0.4.2 (under dev!)
--------------------------
* core: add option weechat.network.proxy_curl (task #12651)
* core: add "proxy" infolist and hdata
* core: fix random crash on mouse actions (bug #39094)
* core: set options weechat.look.color_inactive_{buffer|window} to "on" by
+5
View File
@@ -798,6 +798,11 @@
** Typ: integer
** Werte: 1 .. 2147483647 (Standardwert: `30`)
* [[option_weechat.network.proxy_curl]] *weechat.network.proxy_curl*
** Beschreibung: `name of proxy used for download of URLs with Curl (used to download list of scripts and in scripts calling function hook_process); the proxy must be defined with command /proxy`
** Typ: Zeichenkette
** Werte: beliebige Zeichenkette (Standardwert: `""`)
* [[option_weechat.plugin.autoload]] *weechat.plugin.autoload*
** Beschreibung: `durch Kommata getrennte Liste der Erweiterungen, die beim Programmstart automatisch geladen werden sollen; "*" lädt alle vorhandenen Erweiterungen. Beginnt der Name hingegen mit "!" wird die Erweiterung nicht geladen. Suchmuster können mit einem Joker ("*") beginnen oder enden um mehrere Erweiterungen zu laden (Beispiele: "*" oder "*,!lua,!tcl")`
** Typ: Zeichenkette
+5
View File
@@ -798,6 +798,11 @@
** type: integer
** values: 1 .. 2147483647 (default value: `30`)
* [[option_weechat.network.proxy_curl]] *weechat.network.proxy_curl*
** description: `name of proxy used for download of URLs with Curl (used to download list of scripts and in scripts calling function hook_process); the proxy must be defined with command /proxy`
** type: string
** values: any string (default value: `""`)
* [[option_weechat.plugin.autoload]] *weechat.plugin.autoload*
** description: `comma separated list of plugins to load automatically at startup, "*" means all plugins found, a name beginning with "!" is a negative value to prevent a plugin from being loaded, names can start or end with "*" to match several plugins (examples: "*" or "*,!lua,!tcl")`
** type: string
+5
View File
@@ -798,6 +798,11 @@
** type: entier
** valeurs: 1 .. 2147483647 (valeur par défaut: `30`)
* [[option_weechat.network.proxy_curl]] *weechat.network.proxy_curl*
** description: `nom du proxy utilisé pour télécharger les URLs avec Curl (utilisé pour télécharger la liste des scripts et dans les scripts appelant la fonction hook_process); le proxy doit être défini avec la commande /proxy`
** type: chaîne
** valeurs: toute chaîne (valeur par défaut: `""`)
* [[option_weechat.plugin.autoload]] *weechat.plugin.autoload*
** description: `liste des extensions à charger automatiquement au démarrage (séparées par des virgules), "*" signifie toutes les extensions trouvées, un nom commençant par "!" est une valeur négative pour empêcher une extension d'être chargée, les noms peuvent commencer ou se terminer par "*" pour indiquer plusieurs extensions (exemples: "*" ou "*,!lua,!tcl")`
** type: chaîne
+5
View File
@@ -798,6 +798,11 @@
** tipo: intero
** valori: 1 .. 2147483647 (valore predefinito: `30`)
* [[option_weechat.network.proxy_curl]] *weechat.network.proxy_curl*
** descrizione: `name of proxy used for download of URLs with Curl (used to download list of scripts and in scripts calling function hook_process); the proxy must be defined with command /proxy`
** tipo: stringa
** valori: qualsiasi stringa (valore predefinito: `""`)
* [[option_weechat.plugin.autoload]] *weechat.plugin.autoload*
** descrizione: `elenco separato da virgole di plugin da caricare automaticamente all'avvio, "*" equivale a tutti i plugin trovati. un nome che comincia con "!" è un valore negativo per impedire il caricamento di un plugin, i nomi possono iniziare o finire con "*" per corrispondere a più plugin (esempi: "*" oppure "*,!lua,!tcl")`
** tipo: stringa
+5
View File
@@ -798,6 +798,11 @@
** タイプ: 整数
** 値: 1 .. 2147483647 (デフォルト値: `30`)
* [[option_weechat.network.proxy_curl]] *weechat.network.proxy_curl*
** 説明: `name of proxy used for download of URLs with Curl (used to download list of scripts and in scripts calling function hook_process); the proxy must be defined with command /proxy`
** タイプ: 文字列
** 値: 未制約文字列 (デフォルト値: `""`)
* [[option_weechat.plugin.autoload]] *weechat.plugin.autoload*
** 説明: `スタートアップ時にロードするプラグインのコンマ区切りリスト、"*" は見つかった全てのプラグイン、"!" から始まる名前はロードしないプラグイン、"*" から始まるか終わるかした場合はマッチする複数のプラグイン (例: "*" または "*,!lua,!tcl")`
** タイプ: 文字列
+13 -1
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-06-08 12:28+0200\n"
"POT-Creation-Date: 2013-06-08 17:43+0200\n"
"PO-Revision-Date: 2013-06-08 12:30+0200\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -2337,6 +2337,12 @@ msgid ""
"problems, you must turn off this option."
msgstr ""
#, c-format
msgid ""
"%sWarning: proxy \"%s\" does not exist (you can create it with command /"
"proxy)"
msgstr ""
#, c-format
msgid "\t\tDay changed to %s"
msgstr "\t\tZměnil se den na %s"
@@ -3153,6 +3159,12 @@ msgstr ""
msgid "timeout (in seconds) for gnutls handshake"
msgstr "časový limit (v sekundách) pro gnutls handshake"
msgid ""
"name of proxy used for download of URLs with Curl (used to download list of "
"scripts and in scripts calling function hook_process); the proxy must be "
"defined with command /proxy"
msgstr ""
msgid ""
"comma separated list of plugins to load automatically at startup, \"*\" "
"means all plugins found, a name beginning with \"!\" is a negative value to "
+13 -1
View File
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-06-08 12:28+0200\n"
"POT-Creation-Date: 2013-06-08 17:43+0200\n"
"PO-Revision-Date: 2013-06-08 12:35+0200\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <weechatter@arcor.de>\n"
@@ -2611,6 +2611,12 @@ msgstr ""
"WARNUNG: Diese Option kann schwerwiegende Grafikfehler verursachen. Sollten "
"Grafikfehler auftreten dann ist es ratsam diese Option zu deaktivieren."
#, c-format
msgid ""
"%sWarning: proxy \"%s\" does not exist (you can create it with command /"
"proxy)"
msgstr ""
#, c-format
msgid "\t\tDay changed to %s"
msgstr "\t\tEin neuer Tag bricht an. Heute ist %s"
@@ -3571,6 +3577,12 @@ msgstr ""
msgid "timeout (in seconds) for gnutls handshake"
msgstr "Zeitüberschreitung für gnutls Handshake (in Sekunden)"
msgid ""
"name of proxy used for download of URLs with Curl (used to download list of "
"scripts and in scripts calling function hook_process); the proxy must be "
"defined with command /proxy"
msgstr ""
msgid ""
"comma separated list of plugins to load automatically at startup, \"*\" "
"means all plugins found, a name beginning with \"!\" is a negative value to "
+13 -1
View File
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-06-08 12:28+0200\n"
"POT-Creation-Date: 2013-06-08 17:43+0200\n"
"PO-Revision-Date: 2013-06-08 12:30+0200\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -2462,6 +2462,12 @@ msgstr ""
"ATENCIÓN: esta opción puede causar problemas serios de visualización, si "
"tienes alguno de estos problemas debes desactivar esta opción."
#, c-format
msgid ""
"%sWarning: proxy \"%s\" does not exist (you can create it with command /"
"proxy)"
msgstr ""
#, c-format
msgid "\t\tDay changed to %s"
msgstr "\t\tNuevo día, %s"
@@ -3344,6 +3350,12 @@ msgstr ""
msgid "timeout (in seconds) for gnutls handshake"
msgstr "tiempo de espera (en segundos) para el saludo gnutls"
msgid ""
"name of proxy used for download of URLs with Curl (used to download list of "
"scripts and in scripts calling function hook_process); the proxy must be "
"defined with command /proxy"
msgstr ""
msgid ""
"comma separated list of plugins to load automatically at startup, \"*\" "
"means all plugins found, a name beginning with \"!\" is a negative value to "
+19 -2
View File
@@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-06-08 12:28+0200\n"
"PO-Revision-Date: 2013-06-08 12:30+0200\n"
"POT-Creation-Date: 2013-06-08 17:43+0200\n"
"PO-Revision-Date: 2013-06-08 17:44+0200\n"
"Last-Translator: Sebastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@@ -2540,6 +2540,14 @@ msgstr ""
"ATTENTION: cette option peut causer de sérieux problèmes d'affichage, si "
"vous rencontrez de tels problèmes, vous devez désactiver cette option."
#, c-format
msgid ""
"%sWarning: proxy \"%s\" does not exist (you can create it with command /"
"proxy)"
msgstr ""
"%sAttention: le proxy \"%s\" n'existe pas (vous pouvez le créer avec la "
"commande /proxy)"
#, c-format
msgid "\t\tDay changed to %s"
msgstr "\t\tJour changé: %s"
@@ -3467,6 +3475,15 @@ msgstr ""
"délai d'attente maximum (en secondes) pour la poignée de main (handshake) "
"gnutls"
msgid ""
"name of proxy used for download of URLs with Curl (used to download list of "
"scripts and in scripts calling function hook_process); the proxy must be "
"defined with command /proxy"
msgstr ""
"nom du proxy utilisé pour télécharger les URLs avec Curl (utilisé pour "
"télécharger la liste des scripts et dans les scripts appelant la fonction "
"hook_process); le proxy doit être défini avec la commande /proxy"
msgid ""
"comma separated list of plugins to load automatically at startup, \"*\" "
"means all plugins found, a name beginning with \"!\" is a negative value to "
+13 -1
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-06-08 12:28+0200\n"
"POT-Creation-Date: 2013-06-08 17:43+0200\n"
"PO-Revision-Date: 2013-06-08 12:30+0200\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -2019,6 +2019,12 @@ msgid ""
"problems, you must turn off this option."
msgstr ""
#, c-format
msgid ""
"%sWarning: proxy \"%s\" does not exist (you can create it with command /"
"proxy)"
msgstr ""
#, fuzzy, c-format
msgid "\t\tDay changed to %s"
msgstr "A mai dátum: %s\n"
@@ -2790,6 +2796,12 @@ msgstr ""
msgid "timeout (in seconds) for gnutls handshake"
msgstr "SSL használata a a kapcsolathoz"
msgid ""
"name of proxy used for download of URLs with Curl (used to download list of "
"scripts and in scripts calling function hook_process); the proxy must be "
"defined with command /proxy"
msgstr ""
#, fuzzy
msgid ""
"comma separated list of plugins to load automatically at startup, \"*\" "
+13 -1
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-06-08 12:28+0200\n"
"POT-Creation-Date: 2013-06-08 17:43+0200\n"
"PO-Revision-Date: 2013-06-08 12:30+0200\n"
"Last-Translator: Marco Paolone <marcopaolone@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -2505,6 +2505,12 @@ msgstr ""
"ATTENZIONE: questa opzione può provocare seri bug nella visualizzazione, se "
"si verificano tali problemi, l'opzione va disabilitata."
#, c-format
msgid ""
"%sWarning: proxy \"%s\" does not exist (you can create it with command /"
"proxy)"
msgstr ""
#, c-format
msgid "\t\tDay changed to %s"
msgstr "\t\tOggi è %s"
@@ -3404,6 +3410,12 @@ msgstr ""
msgid "timeout (in seconds) for gnutls handshake"
msgstr "timeout (in secondi) per l'handshake di gnutls"
msgid ""
"name of proxy used for download of URLs with Curl (used to download list of "
"scripts and in scripts calling function hook_process); the proxy must be "
"defined with command /proxy"
msgstr ""
msgid ""
"comma separated list of plugins to load automatically at startup, \"*\" "
"means all plugins found, a name beginning with \"!\" is a negative value to "
+13 -1
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-06-08 12:28+0200\n"
"POT-Creation-Date: 2013-06-08 17:43+0200\n"
"PO-Revision-Date: 2013-06-08 12:30+0200\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/WeeChat>\n"
@@ -2482,6 +2482,12 @@ msgstr ""
"警告: このオプションは致命的な表示上のバグを引き起こします、そのような場合"
"は、このオプションをオフにしてください。"
#, c-format
msgid ""
"%sWarning: proxy \"%s\" does not exist (you can create it with command /"
"proxy)"
msgstr ""
#, c-format
msgid "\t\tDay changed to %s"
msgstr "\t\t%s に日付変更"
@@ -3331,6 +3337,12 @@ msgstr ""
msgid "timeout (in seconds) for gnutls handshake"
msgstr "gnutls ハンドシェイクのタイムアウト (秒単位)"
msgid ""
"name of proxy used for download of URLs with Curl (used to download list of "
"scripts and in scripts calling function hook_process); the proxy must be "
"defined with command /proxy"
msgstr ""
msgid ""
"comma separated list of plugins to load automatically at startup, \"*\" "
"means all plugins found, a name beginning with \"!\" is a negative value to "
+13 -1
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-06-08 12:28+0200\n"
"POT-Creation-Date: 2013-06-08 17:43+0200\n"
"PO-Revision-Date: 2013-06-08 12:30+0200\n"
"Last-Translator: Krzysztof Korościk <soltys@szluug.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -2531,6 +2531,12 @@ msgstr ""
"UWAGA: ta opcja może powodować poważne błędy w wyświetlaniu, jeśli ich "
"doświadczysz należy wyłączyć ta opcję."
#, c-format
msgid ""
"%sWarning: proxy \"%s\" does not exist (you can create it with command /"
"proxy)"
msgstr ""
#, c-format
msgid "\t\tDay changed to %s"
msgstr "\t\tDzień zmienił się na %s"
@@ -3414,6 +3420,12 @@ msgstr ""
msgid "timeout (in seconds) for gnutls handshake"
msgstr "czas oczekiwania (w sekundach) na uwierzytelnienie gnutls"
msgid ""
"name of proxy used for download of URLs with Curl (used to download list of "
"scripts and in scripts calling function hook_process); the proxy must be "
"defined with command /proxy"
msgstr ""
msgid ""
"comma separated list of plugins to load automatically at startup, \"*\" "
"means all plugins found, a name beginning with \"!\" is a negative value to "
+13 -1
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-06-08 12:28+0200\n"
"POT-Creation-Date: 2013-06-08 17:43+0200\n"
"PO-Revision-Date: 2013-06-08 12:30+0200\n"
"Last-Translator: Sergio Durigan Junior <sergiosdj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -2411,6 +2411,12 @@ msgid ""
"problems, you must turn off this option."
msgstr ""
#, c-format
msgid ""
"%sWarning: proxy \"%s\" does not exist (you can create it with command /"
"proxy)"
msgstr ""
#, c-format
msgid "\t\tDay changed to %s"
msgstr "\t\tDia mudado para %s"
@@ -3250,6 +3256,12 @@ msgstr ""
msgid "timeout (in seconds) for gnutls handshake"
msgstr "tempo de espera (em segundos) pelo handshake do gnutls"
msgid ""
"name of proxy used for download of URLs with Curl (used to download list of "
"scripts and in scripts calling function hook_process); the proxy must be "
"defined with command /proxy"
msgstr ""
msgid ""
"comma separated list of plugins to load automatically at startup, \"*\" "
"means all plugins found, a name beginning with \"!\" is a negative value to "
+13 -1
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-06-08 12:28+0200\n"
"POT-Creation-Date: 2013-06-08 17:43+0200\n"
"PO-Revision-Date: 2013-06-08 12:30+0200\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -2041,6 +2041,12 @@ msgid ""
"problems, you must turn off this option."
msgstr ""
#, c-format
msgid ""
"%sWarning: proxy \"%s\" does not exist (you can create it with command /"
"proxy)"
msgstr ""
#, fuzzy, c-format
msgid "\t\tDay changed to %s"
msgstr "Дата сменилась на %s\n"
@@ -2817,6 +2823,12 @@ msgstr ""
msgid "timeout (in seconds) for gnutls handshake"
msgstr "использовать SSL при связи с сервером"
msgid ""
"name of proxy used for download of URLs with Curl (used to download list of "
"scripts and in scripts calling function hook_process); the proxy must be "
"defined with command /proxy"
msgstr ""
#, fuzzy
msgid ""
"comma separated list of plugins to load automatically at startup, \"*\" "
+13 -1
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.1-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-06-08 12:28+0200\n"
"POT-Creation-Date: 2013-06-08 17:43+0200\n"
"PO-Revision-Date: 2013-02-14 18:20+0100\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -1797,6 +1797,12 @@ msgid ""
"problems, you must turn off this option."
msgstr ""
#, c-format
msgid ""
"%sWarning: proxy \"%s\" does not exist (you can create it with command /"
"proxy)"
msgstr ""
#, c-format
msgid "\t\tDay changed to %s"
msgstr ""
@@ -2470,6 +2476,12 @@ msgstr ""
msgid "timeout (in seconds) for gnutls handshake"
msgstr ""
msgid ""
"name of proxy used for download of URLs with Curl (used to download list of "
"scripts and in scripts calling function hook_process); the proxy must be "
"defined with command /proxy"
msgstr ""
msgid ""
"comma separated list of plugins to load automatically at startup, \"*\" "
"means all plugins found, a name beginning with \"!\" is a negative value to "
+34 -2
View File
@@ -243,6 +243,7 @@ struct t_config_option *config_history_display_default;
struct t_config_option *config_network_connection_timeout;
struct t_config_option *config_network_gnutls_ca_file;
struct t_config_option *config_network_gnutls_handshake_timeout;
struct t_config_option *config_network_proxy_curl;
/* config, plugin section */
@@ -612,7 +613,7 @@ config_change_prefix_align_min (void *data, struct t_config_option *option)
}
/*
* Callback for changes on option "weechat.look.prefix_align_more".
* Checks option "weechat.look.prefix_align_more".
*/
int
@@ -627,7 +628,7 @@ config_check_prefix_align_more (void *data, struct t_config_option *option,
}
/*
* Callback for changes on option "weechat.look.prefix_buffer_align_more".
* Checks option "weechat.look.prefix_buffer_align_more".
*/
int
@@ -690,6 +691,29 @@ config_change_network_gnutls_ca_file (void *data,
network_set_gnutls_ca_file ();
}
/*
* Checks option "weechat.network.proxy_curl".
*/
int
config_check_proxy_curl (void *data, struct t_config_option *option,
const char *value)
{
/* make C compiler happy */
(void) data;
(void) option;
if (value && value[0] && !proxy_search (value))
{
gui_chat_printf (NULL,
_("%sWarning: proxy \"%s\" does not exist (you can "
"create it with command /proxy)"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], value);
}
return 1;
}
/*
* Callback for changes on option "weechat.plugin.extension".
*/
@@ -2968,6 +2992,14 @@ config_weechat_init_options ()
"gnutls_handshake_timeout", "integer",
N_("timeout (in seconds) for gnutls handshake"),
NULL, 1, INT_MAX, "30", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
config_network_proxy_curl = config_file_new_option (
weechat_config_file, ptr_section,
"proxy_curl", "string",
N_("name of proxy used for download of URLs with Curl (used to download "
"list of scripts and in scripts calling function hook_process); the "
"proxy must be defined with command /proxy"),
NULL, 0, 0, "", NULL, 0,
&config_check_proxy_curl, NULL, NULL, NULL, NULL, NULL);
/* plugin */
ptr_section = config_file_new_section (weechat_config_file, "plugin",
+1
View File
@@ -259,6 +259,7 @@ extern struct t_config_option *config_history_display_default;
extern struct t_config_option *config_network_connection_timeout;
extern struct t_config_option *config_network_gnutls_ca_file;
extern struct t_config_option *config_network_gnutls_handshake_timeout;
extern struct t_config_option *config_network_proxy_curl;
extern struct t_config_option *config_plugin_autoload;
extern struct t_config_option *config_plugin_debug;
+74
View File
@@ -30,8 +30,10 @@
#include "weechat.h"
#include "wee-url.h"
#include "wee-config.h"
#include "wee-hashtable.h"
#include "wee-infolist.h"
#include "wee-proxy.h"
#include "wee-string.h"
@@ -1074,6 +1076,68 @@ weeurl_option_map_cb (void *data,
return;
}
/*
* Sets proxy in CURL easy handle.
*/
void
weeurl_set_proxy (CURL *curl, struct t_proxy *proxy)
{
if (!proxy)
return;
/* set proxy type */
switch (CONFIG_INTEGER(proxy->options[PROXY_OPTION_TYPE]))
{
case PROXY_TYPE_HTTP:
curl_easy_setopt (curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
break;
case PROXY_TYPE_SOCKS4:
#if LIBCURL_VERSION_NUM >= 0x070A00
/* libcurl >= 7.10 */
curl_easy_setopt (curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4);
#else
/* proxy socks4 not supported in Curl < 7.10 */
return;
#endif
break;
case PROXY_TYPE_SOCKS5:
#if LIBCURL_VERSION_NUM >= 0x070A00
/* libcurl >= 7.10 */
curl_easy_setopt (curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
#else
/* proxy socks4 not supported in Curl < 7.10 */
return;
#endif
break;
}
/* set proxy address */
curl_easy_setopt (curl, CURLOPT_PROXY,
CONFIG_STRING(proxy->options[PROXY_OPTION_ADDRESS]));
/* set proxy port */
curl_easy_setopt (curl, CURLOPT_PROXYPORT,
CONFIG_INTEGER(proxy->options[PROXY_OPTION_PORT]));
/* set username/password */
#if LIBCURL_VERSION_NUM >= 0x071301
/* libcurl >= 7.19.1 */
if (CONFIG_STRING(proxy->options[PROXY_OPTION_USERNAME])
&& CONFIG_STRING(proxy->options[PROXY_OPTION_USERNAME])[0])
{
curl_easy_setopt (curl, CURLOPT_PROXYUSERNAME,
CONFIG_STRING(proxy->options[PROXY_OPTION_USERNAME]));
}
if (CONFIG_STRING(proxy->options[PROXY_OPTION_PASSWORD])
&& CONFIG_STRING(proxy->options[PROXY_OPTION_PASSWORD])[0])
{
curl_easy_setopt (curl, CURLOPT_PROXYPASSWORD,
CONFIG_STRING(proxy->options[PROXY_OPTION_PASSWORD]));
}
#endif
}
/*
* Downloads URL using options.
*
@@ -1095,6 +1159,7 @@ weeurl_download (const char *url, struct t_hashtable *options)
CURLoption url_file_opt_func[2] = { CURLOPT_READFUNCTION, CURLOPT_WRITEFUNCTION };
CURLoption url_file_opt_data[2] = { CURLOPT_READDATA, CURLOPT_WRITEDATA };
void *url_file_opt_cb[2] = { &weeurl_read, &weeurl_write };
struct t_proxy *ptr_proxy;
int rc, i;
rc = 0;
@@ -1122,6 +1187,15 @@ weeurl_download (const char *url, struct t_hashtable *options)
curl_easy_setopt (curl, CURLOPT_URL, url);
curl_easy_setopt (curl, CURLOPT_FOLLOWLOCATION, 1L);
/* set proxy (if option weechat.network.proxy_curl is set) */
if (CONFIG_STRING(config_network_proxy_curl)
&& CONFIG_STRING(config_network_proxy_curl)[0])
{
ptr_proxy = proxy_search (CONFIG_STRING(config_network_proxy_curl));
if (ptr_proxy)
weeurl_set_proxy (curl, ptr_proxy);
}
/* set file in/out from options in hashtable */
if (options)
{