summaryrefslogtreecommitdiff
path: root/src/plugins/irc
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2015-05-07 07:07:09 +0200
committerSébastien Helleu <flashcode@flashtux.org>2015-05-07 07:07:09 +0200
commite2310a426441583aca650ee26d2854a4b413832b (patch)
tree1ce074d4f92c513e8ed30604e7b0b15b43c684e3 /src/plugins/irc
parentc4e260c9926ad4df12ec9503556499ffc371e895 (diff)
downloadweechat-e2310a426441583aca650ee26d2854a4b413832b.zip
irc: display a warning when the option irc.look.display_away is set to "channel"
Diffstat (limited to 'src/plugins/irc')
-rw-r--r--src/plugins/irc/irc-config.c36
1 files changed, 35 insertions, 1 deletions
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;
@@ -327,6 +329,31 @@ irc_config_change_look_color_nicks_in_nicklist (void *data,
}
/*
+ * 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;
}