diff --git a/ChangeLog b/ChangeLog index 6145c9690..48d2dc4ac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 diff --git a/doc/de/autogen/user/weechat_options.txt b/doc/de/autogen/user/weechat_options.txt index ad7b9f3ac..929193bd7 100644 --- a/doc/de/autogen/user/weechat_options.txt +++ b/doc/de/autogen/user/weechat_options.txt @@ -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 diff --git a/doc/en/autogen/user/weechat_options.txt b/doc/en/autogen/user/weechat_options.txt index 2bfed3186..c6ccc5fb8 100644 --- a/doc/en/autogen/user/weechat_options.txt +++ b/doc/en/autogen/user/weechat_options.txt @@ -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 diff --git a/doc/fr/autogen/user/weechat_options.txt b/doc/fr/autogen/user/weechat_options.txt index 3924a0238..3221a9efe 100644 --- a/doc/fr/autogen/user/weechat_options.txt +++ b/doc/fr/autogen/user/weechat_options.txt @@ -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 diff --git a/doc/it/autogen/user/weechat_options.txt b/doc/it/autogen/user/weechat_options.txt index 446088e9b..05286758f 100644 --- a/doc/it/autogen/user/weechat_options.txt +++ b/doc/it/autogen/user/weechat_options.txt @@ -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 diff --git a/doc/ja/autogen/user/weechat_options.txt b/doc/ja/autogen/user/weechat_options.txt index 3ecdec1ff..179920633 100644 --- a/doc/ja/autogen/user/weechat_options.txt +++ b/doc/ja/autogen/user/weechat_options.txt @@ -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")` ** タイプ: 文字列 diff --git a/po/cs.po b/po/cs.po index caa7864f8..5204b647e 100644 --- a/po/cs.po +++ b/po/cs.po @@ -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 \n" "Language-Team: weechat-dev \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 " diff --git a/po/de.po b/po/de.po index a92760a55..044e06125 100644 --- a/po/de.po +++ b/po/de.po @@ -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 \n" "Language-Team: German \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 " diff --git a/po/es.po b/po/es.po index bd8bfd784..7d0198b7a 100644 --- a/po/es.po +++ b/po/es.po @@ -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 \n" "Language-Team: weechat-dev \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 " diff --git a/po/fr.po b/po/fr.po index 1f401d35b..31d0a4b69 100644 --- a/po/fr.po +++ b/po/fr.po @@ -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 \n" "Language-Team: weechat-dev \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 " diff --git a/po/hu.po b/po/hu.po index b682c219c..7a516c7be 100644 --- a/po/hu.po +++ b/po/hu.po @@ -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 \n" "Language-Team: weechat-dev \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, \"*\" " diff --git a/po/it.po b/po/it.po index 498e0a07f..6bd6555ee 100644 --- a/po/it.po +++ b/po/it.po @@ -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 \n" "Language-Team: weechat-dev \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 " diff --git a/po/ja.po b/po/ja.po index 75eda5b11..d38363b23 100644 --- a/po/ja.po +++ b/po/ja.po @@ -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 \n" "Language-Team: Japanese \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 " diff --git a/po/pl.po b/po/pl.po index 740fcf80a..5e9c5bc1a 100644 --- a/po/pl.po +++ b/po/pl.po @@ -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 \n" "Language-Team: weechat-dev \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 " diff --git a/po/pt_BR.po b/po/pt_BR.po index 43365273a..57c7499ed 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -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 \n" "Language-Team: weechat-dev \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 " diff --git a/po/ru.po b/po/ru.po index c9e7af865..aa9ecc208 100644 --- a/po/ru.po +++ b/po/ru.po @@ -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 \n" "Language-Team: weechat-dev \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, \"*\" " diff --git a/po/weechat.pot b/po/weechat.pot index 5939367a4..bb63a5e3d 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -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 \n" "Language-Team: weechat-dev \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 " diff --git a/src/core/wee-config.c b/src/core/wee-config.c index c2de4e3c3..8a16963d1 100644 --- a/src/core/wee-config.c +++ b/src/core/wee-config.c @@ -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", diff --git a/src/core/wee-config.h b/src/core/wee-config.h index df4c01fcb..221eff5e6 100644 --- a/src/core/wee-config.h +++ b/src/core/wee-config.h @@ -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; diff --git a/src/core/wee-url.c b/src/core/wee-url.c index 39184f5d5..454242204 100644 --- a/src/core/wee-url.c +++ b/src/core/wee-url.c @@ -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) {