diff --git a/AUTHORS b/AUTHORS index 4a9dc1981..6ab892edd 100644 --- a/AUTHORS +++ b/AUTHORS @@ -20,6 +20,7 @@ Alphabetically: * Ailin Nemui (Nei) * Aleksey V Zapparov +* Andrew Potter * Arvydas Sidorenko * Benoit Papillault (benoit) * Dmitry Kobylin diff --git a/ChangeLog b/ChangeLog index d7136f063..d6fcc04b7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -93,6 +93,7 @@ Version 0.4.1 (under dev!) * scripts: create directories (language and language/autoload) on each action (install/remove/autoload), just in case they have been removed (bug #38473) * scripts: do not allow empty script name in function "register" +* xfer: add option xfer.file.auto_accept_nicks (patch #7962) * xfer: fix freeze of DCC file received: use non-blocking socket after connection to sender and ensure the ACK is properly sent (bug #38340) diff --git a/doc/de/autogen/user/xfer_options.txt b/doc/de/autogen/user/xfer_options.txt index 139de87e9..de1cef8c9 100644 --- a/doc/de/autogen/user/xfer_options.txt +++ b/doc/de/autogen/user/xfer_options.txt @@ -53,6 +53,11 @@ ** Typ: boolesch ** Werte: on, off (Standardwert: `off`) +* [[option_xfer.file.auto_accept_nicks]] *xfer.file.auto_accept_nicks* +** Beschreibung: `comma-separated list of nicks for which the incoming files and chats are automatically accepted; format is "server.nick" (for a specific server) or "nick" (for all servers); example: "freenode.FlashCode,andrew"` +** Typ: Zeichenkette +** Werte: beliebige Zeichenkette (Standardwert: `""`) + * [[option_xfer.file.auto_rename]] *xfer.file.auto_rename* ** Beschreibung: `eingehende Dateien werden automatisch umbenannt um ein Überschreiben zu vermeiden (dabei wird dem Dateinamen '.1', '.2', ... hinzugefügt)` ** Typ: boolesch diff --git a/doc/en/autogen/user/xfer_options.txt b/doc/en/autogen/user/xfer_options.txt index 12c35b67d..d9c8a23f8 100644 --- a/doc/en/autogen/user/xfer_options.txt +++ b/doc/en/autogen/user/xfer_options.txt @@ -53,6 +53,11 @@ ** type: boolean ** values: on, off (default value: `off`) +* [[option_xfer.file.auto_accept_nicks]] *xfer.file.auto_accept_nicks* +** description: `comma-separated list of nicks for which the incoming files and chats are automatically accepted; format is "server.nick" (for a specific server) or "nick" (for all servers); example: "freenode.FlashCode,andrew"` +** type: string +** values: any string (default value: `""`) + * [[option_xfer.file.auto_rename]] *xfer.file.auto_rename* ** description: `rename incoming files if already exists (add ".1", ".2", ...)` ** type: boolean diff --git a/doc/fr/autogen/user/xfer_options.txt b/doc/fr/autogen/user/xfer_options.txt index 449f94b27..1aa3e6e23 100644 --- a/doc/fr/autogen/user/xfer_options.txt +++ b/doc/fr/autogen/user/xfer_options.txt @@ -53,6 +53,11 @@ ** type: booléen ** valeurs: on, off (valeur par défaut: `off`) +* [[option_xfer.file.auto_accept_nicks]] *xfer.file.auto_accept_nicks* +** description: `liste de pseudos (séparés par des virgules) pour lesquels les demandes d'envoi de fichiers et de discussion sont automatiquement acceptées; le format est "serveur.pseudo" (pour un serveur spécifique) ou "pseudo" (pour tous les serveurs); exemple: "freenode.FlashCode,andrew"` +** type: chaîne +** valeurs: toute chaîne (valeur par défaut: `""`) + * [[option_xfer.file.auto_rename]] *xfer.file.auto_rename* ** description: `renommer les fichiers reçus s'ils existent déjà (ajoute ".1", ".2", ...)` ** type: booléen diff --git a/doc/it/autogen/user/xfer_options.txt b/doc/it/autogen/user/xfer_options.txt index 918cdad63..deaae7e48 100644 --- a/doc/it/autogen/user/xfer_options.txt +++ b/doc/it/autogen/user/xfer_options.txt @@ -53,6 +53,11 @@ ** tipo: bool ** valori: on, off (valore predefinito: `off`) +* [[option_xfer.file.auto_accept_nicks]] *xfer.file.auto_accept_nicks* +** descrizione: `comma-separated list of nicks for which the incoming files and chats are automatically accepted; format is "server.nick" (for a specific server) or "nick" (for all servers); example: "freenode.FlashCode,andrew"` +** tipo: stringa +** valori: qualsiasi stringa (valore predefinito: `""`) + * [[option_xfer.file.auto_rename]] *xfer.file.auto_rename* ** descrizione: `rinomina i file in ingresso se esistenti (aggiunge ".1", ".2", ...)` ** tipo: bool diff --git a/doc/ja/autogen/user/xfer_options.txt b/doc/ja/autogen/user/xfer_options.txt index e5453cb15..40ffdbac7 100644 --- a/doc/ja/autogen/user/xfer_options.txt +++ b/doc/ja/autogen/user/xfer_options.txt @@ -53,6 +53,11 @@ ** タイプ: ブール ** 値: on, off (デフォルト値: `off`) +* [[option_xfer.file.auto_accept_nicks]] *xfer.file.auto_accept_nicks* +** 説明: `comma-separated list of nicks for which the incoming files and chats are automatically accepted; format is "server.nick" (for a specific server) or "nick" (for all servers); example: "freenode.FlashCode,andrew"` +** タイプ: 文字列 +** 値: 未制約文字列 (デフォルト値: `""`) + * [[option_xfer.file.auto_rename]] *xfer.file.auto_rename* ** 説明: `既に存在する場合、受信ファイルをリネームする (".1"、".2"、...を追加)` ** タイプ: ブール diff --git a/po/cs.po b/po/cs.po index 24f5981e2..ebb2cb980 100644 --- a/po/cs.po +++ b/po/cs.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.1-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-03-24 12:25+0100\n" +"POT-Creation-Date: 2013-03-25 09:00+0100\n" "PO-Revision-Date: 2013-03-16 17:49+0100\n" "Last-Translator: Jiri Golembiovsky \n" "Language-Team: weechat-dev \n" @@ -9311,6 +9311,12 @@ msgstr "automaticky akceptovat příchozí soubory (používejte opatrně!)" msgid "automatically accept chat requests (use carefully!)" msgstr "automaticky akceptovat požadavek o rozhovor (používejte opatrně!)" +msgid "" +"comma-separated list of nicks for which the incoming files and chats are " +"automatically accepted; format is \"server.nick\" (for a specific server) or " +"\"nick\" (for all servers); example: \"freenode.FlashCode,andrew\"" +msgstr "" + msgid "list of xfer" msgstr "seznam xfer" diff --git a/po/de.po b/po/de.po index a365b6015..36a31813e 100644 --- a/po/de.po +++ b/po/de.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.1-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-03-24 12:25+0100\n" +"POT-Creation-Date: 2013-03-25 09:00+0100\n" "PO-Revision-Date: 2013-03-17 08:20+0100\n" "Last-Translator: Nils Görs \n" "Language-Team: German \n" @@ -10195,6 +10195,12 @@ msgstr "eine Datenübertragung wird automatisch angenommen (Vorsicht!)" msgid "automatically accept chat requests (use carefully!)" msgstr "eine Chat-Anfrage wird automatisch akzeptiert (Vorsicht!)" +msgid "" +"comma-separated list of nicks for which the incoming files and chats are " +"automatically accepted; format is \"server.nick\" (for a specific server) or " +"\"nick\" (for all servers); example: \"freenode.FlashCode,andrew\"" +msgstr "" + msgid "list of xfer" msgstr "Transferliste" diff --git a/po/es.po b/po/es.po index e8498e570..62597e4c5 100644 --- a/po/es.po +++ b/po/es.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.1-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-03-24 12:25+0100\n" +"POT-Creation-Date: 2013-03-25 09:00+0100\n" "PO-Revision-Date: 2013-03-17 08:20+0100\n" "Last-Translator: Elián Hanisch \n" "Language-Team: weechat-dev \n" @@ -9558,6 +9558,12 @@ msgstr "" "aceptar automáticamente peticiones de conversación (¡utilizar con " "precaución!)" +msgid "" +"comma-separated list of nicks for which the incoming files and chats are " +"automatically accepted; format is \"server.nick\" (for a specific server) or " +"\"nick\" (for all servers); example: \"freenode.FlashCode,andrew\"" +msgstr "" + msgid "list of xfer" msgstr "lista de transferencias" diff --git a/po/fr.po b/po/fr.po index 1cd5371e0..dbdf84528 100644 --- a/po/fr.po +++ b/po/fr.po @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.1-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-03-24 12:58+0100\n" -"PO-Revision-Date: 2013-03-24 12:26+0100\n" +"POT-Creation-Date: 2013-03-25 09:00+0100\n" +"PO-Revision-Date: 2013-03-25 09:01+0100\n" "Last-Translator: Sebastien Helleu \n" "Language-Team: weechat-dev \n" "Language: fr\n" @@ -9929,6 +9929,16 @@ msgstr "" "accepte automatiquement les demandes de discussion (à utiliser avec " "précaution !)" +msgid "" +"comma-separated list of nicks for which the incoming files and chats are " +"automatically accepted; format is \"server.nick\" (for a specific server) or " +"\"nick\" (for all servers); example: \"freenode.FlashCode,andrew\"" +msgstr "" +"liste de pseudos (séparés par des virgules) pour lesquels les demandes " +"d'envoi de fichiers et de discussion sont automatiquement acceptées; le " +"format est \"serveur.pseudo\" (pour un serveur spécifique) ou \"pseudo" +"\" (pour tous les serveurs); exemple: \"freenode.FlashCode,andrew\"" + msgid "list of xfer" msgstr "liste des xfer" diff --git a/po/hu.po b/po/hu.po index 56727b060..ae6e9a80b 100644 --- a/po/hu.po +++ b/po/hu.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.1-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-03-24 12:25+0100\n" +"POT-Creation-Date: 2013-03-25 09:00+0100\n" "PO-Revision-Date: 2013-03-16 17:50+0100\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -8776,6 +8776,12 @@ msgstr "dcc beszélgetések automatikus fogadása (óvatosan használja!)" msgid "automatically accept chat requests (use carefully!)" msgstr "dcc beszélgetések automatikus fogadása (óvatosan használja!)" +msgid "" +"comma-separated list of nicks for which the incoming files and chats are " +"automatically accepted; format is \"server.nick\" (for a specific server) or " +"\"nick\" (for all servers); example: \"freenode.FlashCode,andrew\"" +msgstr "" + #, fuzzy msgid "list of xfer" msgstr "Aliaszok listája:\n" diff --git a/po/it.po b/po/it.po index 13406d08c..a8c706b32 100644 --- a/po/it.po +++ b/po/it.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.1-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-03-24 12:25+0100\n" +"POT-Creation-Date: 2013-03-25 09:00+0100\n" "PO-Revision-Date: 2013-03-17 08:20+0100\n" "Last-Translator: Marco Paolone \n" "Language-Team: weechat-dev \n" @@ -9587,6 +9587,12 @@ msgstr "accetta automaticamente i file in arrivo (usare con cautela!)" msgid "automatically accept chat requests (use carefully!)" msgstr "accetta automaticamente le richieste di chat (usare con cautela!)" +msgid "" +"comma-separated list of nicks for which the incoming files and chats are " +"automatically accepted; format is \"server.nick\" (for a specific server) or " +"\"nick\" (for all servers); example: \"freenode.FlashCode,andrew\"" +msgstr "" + msgid "list of xfer" msgstr "elenco di xfer" diff --git a/po/ja.po b/po/ja.po index 52c02a714..d5afb3121 100644 --- a/po/ja.po +++ b/po/ja.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.1-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-03-24 12:25+0100\n" +"POT-Creation-Date: 2013-03-25 09:00+0100\n" "PO-Revision-Date: 2013-03-17 08:20+0100\n" "Last-Translator: AYANOKOUZI, Ryuunosuke \n" "Language-Team: Japanese \n" @@ -9578,6 +9578,12 @@ msgstr "ファイルを自動的に受信 (注意して使用!)" msgid "automatically accept chat requests (use carefully!)" msgstr "チャット要求を自動的に許可 (注意して使用!)" +msgid "" +"comma-separated list of nicks for which the incoming files and chats are " +"automatically accepted; format is \"server.nick\" (for a specific server) or " +"\"nick\" (for all servers); example: \"freenode.FlashCode,andrew\"" +msgstr "" + msgid "list of xfer" msgstr "xfer のリスト" diff --git a/po/pl.po b/po/pl.po index aab71bf8a..3de61ba53 100644 --- a/po/pl.po +++ b/po/pl.po @@ -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-03-24 12:25+0100\n" +"POT-Creation-Date: 2013-03-25 09:00+0100\n" "PO-Revision-Date: 2013-03-17 08:20+0100\n" "Last-Translator: Krzysztof Korościk \n" "Language-Team: weechat-dev \n" @@ -9732,6 +9732,12 @@ msgstr "automatycznie akceptuj pliki przychodzące (ostrożnie!)" msgid "automatically accept chat requests (use carefully!)" msgstr "automatycznie akceptuj prośby o rozmowę (ostrożnie!)" +msgid "" +"comma-separated list of nicks for which the incoming files and chats are " +"automatically accepted; format is \"server.nick\" (for a specific server) or " +"\"nick\" (for all servers); example: \"freenode.FlashCode,andrew\"" +msgstr "" + msgid "list of xfer" msgstr "lista xfer" diff --git a/po/pt_BR.po b/po/pt_BR.po index abbef10e3..0abf5688e 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -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-03-24 12:25+0100\n" +"POT-Creation-Date: 2013-03-25 09:00+0100\n" "PO-Revision-Date: 2013-03-17 08:20+0100\n" "Last-Translator: Sergio Durigan Junior \n" "Language-Team: weechat-dev \n" @@ -8943,6 +8943,12 @@ msgstr "aceitar automaticamente arquivos enviados a mim (use com cuidado!)" msgid "automatically accept chat requests (use carefully!)" msgstr "aceitar automaticamente requisições de chat (use com cuidado!)" +msgid "" +"comma-separated list of nicks for which the incoming files and chats are " +"automatically accepted; format is \"server.nick\" (for a specific server) or " +"\"nick\" (for all servers); example: \"freenode.FlashCode,andrew\"" +msgstr "" + msgid "list of xfer" msgstr "lista de transferência" diff --git a/po/ru.po b/po/ru.po index 971207e18..5938b4a21 100644 --- a/po/ru.po +++ b/po/ru.po @@ -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-03-24 12:25+0100\n" +"POT-Creation-Date: 2013-03-25 09:00+0100\n" "PO-Revision-Date: 2013-03-16 17:50+0100\n" "Last-Translator: Aleksey V Zapparov AKA ixti \n" "Language-Team: weechat-dev \n" @@ -8796,6 +8796,12 @@ msgstr "автоматически подтверждать dcc-чат (испо msgid "automatically accept chat requests (use carefully!)" msgstr "автоматически подтверждать dcc-чат (используйте осторожно!)" +msgid "" +"comma-separated list of nicks for which the incoming files and chats are " +"automatically accepted; format is \"server.nick\" (for a specific server) or " +"\"nick\" (for all servers); example: \"freenode.FlashCode,andrew\"" +msgstr "" + #, fuzzy msgid "list of xfer" msgstr "Список сокращений:\n" diff --git a/po/weechat.pot b/po/weechat.pot index 055f1b8ee..422296356 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-03-24 12:25+0100\n" +"POT-Creation-Date: 2013-03-25 09:00+0100\n" "PO-Revision-Date: 2013-02-14 18:20+0100\n" "Last-Translator: FULL NAME \n" "Language-Team: weechat-dev \n" @@ -7776,6 +7776,12 @@ msgstr "" msgid "automatically accept chat requests (use carefully!)" msgstr "" +msgid "" +"comma-separated list of nicks for which the incoming files and chats are " +"automatically accepted; format is \"server.nick\" (for a specific server) or " +"\"nick\" (for all servers); example: \"freenode.FlashCode,andrew\"" +msgstr "" + msgid "list of xfer" msgstr "" diff --git a/src/plugins/xfer/xfer-config.c b/src/plugins/xfer/xfer-config.c index ab9171e20..6c35c66a7 100644 --- a/src/plugins/xfer/xfer-config.c +++ b/src/plugins/xfer/xfer-config.c @@ -61,6 +61,7 @@ struct t_config_option *xfer_config_file_auto_rename; struct t_config_option *xfer_config_file_auto_resume; struct t_config_option *xfer_config_file_auto_accept_files; struct t_config_option *xfer_config_file_auto_accept_chats; +struct t_config_option *xfer_config_file_auto_accept_nicks; @@ -304,6 +305,14 @@ xfer_config_init () "auto_accept_chats", "boolean", N_("automatically accept chat requests (use carefully!)"), NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); + xfer_config_file_auto_accept_nicks = weechat_config_new_option ( + xfer_config_file, ptr_section, + "auto_accept_nicks", "string", + N_("comma-separated list of nicks for which the incoming files and " + "chats are automatically accepted; format is \"server.nick\" (for a " + "specific server) or \"nick\" (for all servers); example: " + "\"freenode.FlashCode,andrew\""), + NULL, 0, 0, "", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); return 1; } diff --git a/src/plugins/xfer/xfer-config.h b/src/plugins/xfer/xfer-config.h index 051e4d85e..e43727831 100644 --- a/src/plugins/xfer/xfer-config.h +++ b/src/plugins/xfer/xfer-config.h @@ -49,6 +49,7 @@ extern struct t_config_option *xfer_config_file_auto_rename; extern struct t_config_option *xfer_config_file_auto_resume; extern struct t_config_option *xfer_config_file_auto_accept_files; extern struct t_config_option *xfer_config_file_auto_accept_chats; +extern struct t_config_option *xfer_config_file_auto_accept_nicks; extern int xfer_config_init (); extern int xfer_config_read (); diff --git a/src/plugins/xfer/xfer.c b/src/plugins/xfer/xfer.c index 194fce09d..653af92f1 100644 --- a/src/plugins/xfer/xfer.c +++ b/src/plugins/xfer/xfer.c @@ -519,6 +519,53 @@ xfer_alloc () return new_xfer; } +/* + * Checks if the given server/nick is auto-accepted. + * + * Returns: + * 1: nick auto-accepted + * 0: nick not auto-accepted + */ + +int +xfer_nick_auto_accepted (const char *server, const char *nick) +{ + int rc, num_nicks, i; + char **nicks, *pos; + + rc = 0; + + nicks = weechat_string_split (weechat_config_string (xfer_config_file_auto_accept_nicks), + ",", 0, 0, &num_nicks); + if (nicks) + { + for (i = 0; i < num_nicks; i++) + { + pos = strchr (nicks[i], '.'); + if (pos) + { + if ((weechat_strncasecmp (server, nicks[i], pos - nicks[i]) == 0) + && (weechat_strcasecmp (nick, pos + 1) == 0)) + { + rc = 1; + break; + } + } + else + { + if (weechat_strcasecmp (nick, nicks[i]) == 0) + { + rc = 1; + break; + } + } + } + weechat_string_free_split (nicks); + } + + return rc; +} + /* * Adds a xfer to list. * @@ -678,13 +725,22 @@ xfer_new (const char *plugin_name, const char *plugin_id, } } - if ( ( (type == XFER_TYPE_FILE_RECV) - && (weechat_config_boolean (xfer_config_file_auto_accept_files)) ) - || ( (type == XFER_TYPE_CHAT_RECV) - && (weechat_config_boolean (xfer_config_file_auto_accept_chats)) ) ) + /* + * auto-accept file/chat if nick is auto-accepted, or if file/chat is + * auto-accepted + */ + if (xfer_nick_auto_accepted (new_xfer->plugin_id, new_xfer->remote_nick) + || ((type == XFER_TYPE_FILE_RECV) + && weechat_config_boolean (xfer_config_file_auto_accept_files)) + || ((type == XFER_TYPE_CHAT_RECV) + && weechat_config_boolean (xfer_config_file_auto_accept_chats))) + { xfer_network_accept (new_xfer); + } else + { xfer_buffer_refresh (WEECHAT_HOTLIST_PRIVATE); + } return new_xfer; }