From e2310a426441583aca650ee26d2854a4b413832b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Thu, 7 May 2015 07:07:09 +0200 Subject: [PATCH] irc: display a warning when the option irc.look.display_away is set to "channel" --- ChangeLog.asciidoc | 2 ++ po/cs.po | 9 ++++++++- po/de.po | 9 ++++++++- po/es.po | 9 ++++++++- po/fr.po | 15 +++++++++++++-- po/hu.po | 9 ++++++++- po/it.po | 9 ++++++++- po/ja.po | 9 ++++++++- po/pl.po | 9 ++++++++- po/pt_BR.po | 9 ++++++++- po/ru.po | 9 ++++++++- po/tr.po | 9 ++++++++- po/weechat.pot | 9 ++++++++- src/plugins/irc/irc-config.c | 36 +++++++++++++++++++++++++++++++++++- 14 files changed, 138 insertions(+), 14 deletions(-) diff --git a/ChangeLog.asciidoc b/ChangeLog.asciidoc index b7c3ca0ae..59d0b7ea9 100644 --- a/ChangeLog.asciidoc +++ b/ChangeLog.asciidoc @@ -38,6 +38,8 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] * api: add support of full color option name in functions color() and string_eval_expression() and in command /eval * api: add "_chat_line" (line pointer) in hashtable of hook_focus +* irc: display a warning when the option irc.look.display_away is set to + "channel" * irc: optimize search of a nick in nicklist (up to 3x faster) * irc: add support of SHA-256 and SHA-512 algorithms in server option "ssl_fingerprint" (closes #281) diff --git a/po/cs.po b/po/cs.po index fbcdd40ee..e02fa3dcb 100644 --- a/po/cs.po +++ b/po/cs.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-04-26 10:44+0200\n" +"POT-Creation-Date: 2015-05-07 07:02+0200\n" "PO-Revision-Date: 2015-03-21 08:41+0100\n" "Last-Translator: Jiri Golembiovsky \n" "Language-Team: weechat-dev \n" @@ -6661,6 +6661,13 @@ msgstr "čísla pro definované ignorování" msgid "nicks in notify list" msgstr "přezdívky v seznamu notifikací" +#, c-format +msgid "" +"%sWARNING: the value \"channel\" for option \"irc.look.display_away\" will " +"send all your away changes to the channels, which is often considered as " +"spam; therefore you could be banned from channels, you are warned!" +msgstr "" + #, c-format msgid "" "%s%s: warning: proxy \"%s\" does not exist (you can create it with command /" diff --git a/po/de.po b/po/de.po index 9f5a9995e..5b1655f8a 100644 --- a/po/de.po +++ b/po/de.po @@ -24,7 +24,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-04-26 10:44+0200\n" +"POT-Creation-Date: 2015-05-07 07:02+0200\n" "PO-Revision-Date: 2015-04-26 13:08+0100\n" "Last-Translator: Nils Görs \n" "Language-Team: German <>\n" @@ -7643,6 +7643,13 @@ msgstr "Anzahl für festgelegte Ignorierungen" msgid "nicks in notify list" msgstr "Nicks für die eine Benachrichtigung existiert" +#, c-format +msgid "" +"%sWARNING: the value \"channel\" for option \"irc.look.display_away\" will " +"send all your away changes to the channels, which is often considered as " +"spam; therefore you could be banned from channels, you are warned!" +msgstr "" + #, c-format msgid "" "%s%s: warning: proxy \"%s\" does not exist (you can create it with command /" diff --git a/po/es.po b/po/es.po index 92ebc1bee..959c0a01e 100644 --- a/po/es.po +++ b/po/es.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-04-26 10:44+0200\n" +"POT-Creation-Date: 2015-05-07 07:02+0200\n" "PO-Revision-Date: 2015-03-21 08:41+0100\n" "Last-Translator: Elián Hanisch \n" "Language-Team: weechat-dev \n" @@ -6904,6 +6904,13 @@ msgstr "números para los ignores definidos" msgid "nicks in notify list" msgstr "apodos en la lista de notificación" +#, c-format +msgid "" +"%sWARNING: the value \"channel\" for option \"irc.look.display_away\" will " +"send all your away changes to the channels, which is often considered as " +"spam; therefore you could be banned from channels, you are warned!" +msgstr "" + #, c-format msgid "" "%s%s: warning: proxy \"%s\" does not exist (you can create it with command /" diff --git a/po/fr.po b/po/fr.po index eeef3b0c2..804cebeae 100644 --- a/po/fr.po +++ b/po/fr.po @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-04-26 10:44+0200\n" -"PO-Revision-Date: 2015-04-26 11:43+0200\n" +"POT-Creation-Date: 2015-05-07 07:02+0200\n" +"PO-Revision-Date: 2015-05-07 07:03+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" "Language: fr\n" @@ -7484,6 +7484,17 @@ msgstr "numéros pour les ignores définis" msgid "nicks in notify list" msgstr "pseudos dans la liste de notifications" +#, c-format +msgid "" +"%sWARNING: the value \"channel\" for option \"irc.look.display_away\" will " +"send all your away changes to the channels, which is often considered as " +"spam; therefore you could be banned from channels, you are warned!" +msgstr "" +"%sATTENTION : la valeur \"channel\" pour l'option \"irc.look.display_away\" " +"enverra tous vos statuts d'absence aux canaux, ce qui est souvent considéré " +"comme du spam ; par conséquent vous pourriez être bannis de canaux, vous " +"êtes prévenus !" + #, c-format msgid "" "%s%s: warning: proxy \"%s\" does not exist (you can create it with command /" diff --git a/po/hu.po b/po/hu.po index 6c5d050f5..e9bfdb75e 100644 --- a/po/hu.po +++ b/po/hu.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-04-26 10:44+0200\n" +"POT-Creation-Date: 2015-05-07 07:02+0200\n" "PO-Revision-Date: 2015-03-21 08:41+0100\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -6167,6 +6167,13 @@ msgstr "" msgid "nicks in notify list" msgstr "%s nem található ilyen mellőzés\n" +#, c-format +msgid "" +"%sWARNING: the value \"channel\" for option \"irc.look.display_away\" will " +"send all your away changes to the channels, which is often considered as " +"spam; therefore you could be banned from channels, you are warned!" +msgstr "" + #, c-format msgid "" "%s%s: warning: proxy \"%s\" does not exist (you can create it with command /" diff --git a/po/it.po b/po/it.po index 38e764ddb..e890c88ac 100644 --- a/po/it.po +++ b/po/it.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-04-26 10:44+0200\n" +"POT-Creation-Date: 2015-05-07 07:02+0200\n" "PO-Revision-Date: 2015-03-21 08:41+0100\n" "Last-Translator: Esteban I. Ruiz Moreno \n" "Language-Team: weechat-dev \n" @@ -7050,6 +7050,13 @@ msgstr "numero di ignore definiti" msgid "nicks in notify list" msgstr "nick nella lista notifiche" +#, c-format +msgid "" +"%sWARNING: the value \"channel\" for option \"irc.look.display_away\" will " +"send all your away changes to the channels, which is often considered as " +"spam; therefore you could be banned from channels, you are warned!" +msgstr "" + #, c-format msgid "" "%s%s: warning: proxy \"%s\" does not exist (you can create it with command /" diff --git a/po/ja.po b/po/ja.po index c682cca13..ba78b5fac 100644 --- a/po/ja.po +++ b/po/ja.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-04-26 10:44+0200\n" +"POT-Creation-Date: 2015-05-07 07:02+0200\n" "PO-Revision-Date: 2015-04-29 02:38+0900\n" "Last-Translator: AYANOKOUZI, Ryuunosuke \n" "Language-Team: Japanese \n" @@ -7188,6 +7188,13 @@ msgstr "無視エントリの数" msgid "nicks in notify list" msgstr "通知エントリのニックネーム" +#, c-format +msgid "" +"%sWARNING: the value \"channel\" for option \"irc.look.display_away\" will " +"send all your away changes to the channels, which is often considered as " +"spam; therefore you could be banned from channels, you are warned!" +msgstr "" + #, c-format msgid "" "%s%s: warning: proxy \"%s\" does not exist (you can create it with command /" diff --git a/po/pl.po b/po/pl.po index 9c463ca0b..ea9b691fb 100644 --- a/po/pl.po +++ b/po/pl.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-04-26 10:44+0200\n" +"POT-Creation-Date: 2015-05-07 07:02+0200\n" "PO-Revision-Date: 2015-03-21 08:41+0100\n" "Last-Translator: Krzysztof Korościk \n" "Language-Team: weechat-dev \n" @@ -7294,6 +7294,13 @@ msgstr "numery zdefiniowanych ignorów" msgid "nicks in notify list" msgstr "nicki na liście powiadomień" +#, c-format +msgid "" +"%sWARNING: the value \"channel\" for option \"irc.look.display_away\" will " +"send all your away changes to the channels, which is often considered as " +"spam; therefore you could be banned from channels, you are warned!" +msgstr "" + #, c-format msgid "" "%s%s: warning: proxy \"%s\" does not exist (you can create it with command /" diff --git a/po/pt_BR.po b/po/pt_BR.po index ee72fc177..5a6aa2883 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-04-26 10:44+0200\n" +"POT-Creation-Date: 2015-05-07 07:02+0200\n" "PO-Revision-Date: 2015-03-21 08:41+0100\n" "Last-Translator: Eduardo Elias \n" "Language-Team: weechat-dev \n" @@ -6522,6 +6522,13 @@ msgstr "numéros para ignores definidos" msgid "nicks in notify list" msgstr "apelidos na lista de notificação" +#, c-format +msgid "" +"%sWARNING: the value \"channel\" for option \"irc.look.display_away\" will " +"send all your away changes to the channels, which is often considered as " +"spam; therefore you could be banned from channels, you are warned!" +msgstr "" + #, c-format msgid "" "%s%s: warning: proxy \"%s\" does not exist (you can create it with command /" diff --git a/po/ru.po b/po/ru.po index ccf5c37d1..54de0da7f 100644 --- a/po/ru.po +++ b/po/ru.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-04-26 10:44+0200\n" +"POT-Creation-Date: 2015-05-07 07:02+0200\n" "PO-Revision-Date: 2015-03-21 08:41+0100\n" "Last-Translator: Aleksey V Zapparov AKA ixti \n" "Language-Team: weechat-dev \n" @@ -6193,6 +6193,13 @@ msgstr "" msgid "nicks in notify list" msgstr "%s игнорирования не найдены\n" +#, c-format +msgid "" +"%sWARNING: the value \"channel\" for option \"irc.look.display_away\" will " +"send all your away changes to the channels, which is often considered as " +"spam; therefore you could be banned from channels, you are warned!" +msgstr "" + #, c-format msgid "" "%s%s: warning: proxy \"%s\" does not exist (you can create it with command /" diff --git a/po/tr.po b/po/tr.po index 5a0cd0f1b..acd5400c1 100644 --- a/po/tr.po +++ b/po/tr.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-04-26 10:44+0200\n" +"POT-Creation-Date: 2015-05-07 07:02+0200\n" "PO-Revision-Date: 2015-03-10 21:33+0100\n" "Last-Translator: Hasan Kiran \n" "Language-Team: weechat-dev \n" @@ -5519,6 +5519,13 @@ msgstr "" msgid "nicks in notify list" msgstr "" +#, c-format +msgid "" +"%sWARNING: the value \"channel\" for option \"irc.look.display_away\" will " +"send all your away changes to the channels, which is often considered as " +"spam; therefore you could be banned from channels, you are warned!" +msgstr "" + #, c-format msgid "" "%s%s: warning: proxy \"%s\" does not exist (you can create it with command /" diff --git a/po/weechat.pot b/po/weechat.pot index ff59dec24..faf4d0164 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2015-04-26 10:44+0200\n" +"POT-Creation-Date: 2015-05-07 07:02+0200\n" "PO-Revision-Date: 2014-08-16 10:27+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" @@ -5454,6 +5454,13 @@ msgstr "" msgid "nicks in notify list" msgstr "" +#, c-format +msgid "" +"%sWARNING: the value \"channel\" for option \"irc.look.display_away\" will " +"send all your away changes to the channels, which is often considered as " +"spam; therefore you could be banned from channels, you are warned!" +msgstr "" + #, c-format msgid "" "%s%s: warning: proxy \"%s\" does not exist (you can create it with command /" diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c index 488c8911b..0806b2bb7 100644 --- a/src/plugins/irc/irc-config.c +++ b/src/plugins/irc/irc-config.c @@ -47,6 +47,8 @@ struct t_config_section *irc_config_section_ctcp = NULL; struct t_config_section *irc_config_section_server_default = NULL; struct t_config_section *irc_config_section_server = NULL; +int irc_config_loading = 0; + /* IRC config, look section */ struct t_config_option *irc_config_look_buffer_open_before_autojoin; @@ -326,6 +328,31 @@ irc_config_change_look_color_nicks_in_nicklist (void *data, irc_nick_nicklist_set_color_all (); } +/* + * Callback for changes on option "irc.look.display_away". + */ + +void +irc_config_change_look_display_away (void *data, + struct t_config_option *option) +{ + /* make C compiler happy */ + (void) data; + (void) option; + + if (!irc_config_loading + && (weechat_config_integer (irc_config_look_display_away) == IRC_CONFIG_DISPLAY_AWAY_CHANNEL)) + { + weechat_printf ( + NULL, + _("%sWARNING: the value \"channel\" for option " + "\"irc.look.display_away\" will send all your away changes to " + "the channels, which is often considered as spam; therefore you " + "could be banned from channels, you are warned!"), + weechat_prefix ("error")); + } +} + /* * Callback for changes on option "irc.look.display_join_message". */ @@ -1279,7 +1306,9 @@ irc_config_reload (void *data, struct t_config_file *config_file) irc_ignore_free_all (); + irc_config_loading = 1; rc = weechat_config_reload (config_file); + irc_config_loading = 0; ptr_server = irc_servers; while (ptr_server) @@ -2409,7 +2438,8 @@ irc_config_init () "display_away", "integer", N_("display message when (un)marking as away (off: do not display/send " "anything, local: display locally, channel: send action to channels)"), - "off|local|channel", 0, 0, "local", NULL, 0, NULL, NULL, NULL, NULL, + "off|local|channel", 0, 0, "local", NULL, 0, NULL, NULL, + &irc_config_change_look_display_away, NULL, NULL, NULL); irc_config_look_display_ctcp_blocked = weechat_config_new_option ( irc_config_file, ptr_section, @@ -3094,7 +3124,10 @@ irc_config_read () { int rc; + irc_config_loading = 1; rc = weechat_config_read (irc_config_file); + irc_config_loading = 0; + if (rc == WEECHAT_CONFIG_READ_OK) { irc_notify_new_for_all_servers (); @@ -3106,6 +3139,7 @@ irc_config_read () irc_config_change_network_notify_check_ison (NULL, NULL); irc_config_change_network_notify_check_whois (NULL, NULL); } + return rc; }