diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2013-06-08 12:32:09 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2013-06-08 12:32:09 +0200 |
commit | 950287d38516cf66183d1ce53b7dd1050cacac42 (patch) | |
tree | 083c98ede008aca0164dad4937659b8827779f04 /src/plugins/irc | |
parent | 21356d9909bd6da1c39b15bac88189fe5826b3f7 (diff) | |
download | weechat-950287d38516cf66183d1ce53b7dd1050cacac42.zip |
irc: display a warning when the proxy set in a server does not exist
Diffstat (limited to 'src/plugins/irc')
-rw-r--r-- | src/plugins/irc/irc-config.c | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c index 9deb40763..e0bf8d6e9 100644 --- a/src/plugins/irc/irc-config.c +++ b/src/plugins/irc/irc-config.c @@ -997,8 +997,9 @@ irc_config_server_check_value_cb (void *data, struct t_config_option *option, const char *value) { - int index_option; - const char *pos_error; + int index_option, proxy_found; + const char *pos_error, *proxy_name; + struct t_infolist *infolist; /* make C compiler happy */ (void) option; @@ -1008,6 +1009,35 @@ irc_config_server_check_value_cb (void *data, { switch (index_option) { + case IRC_SERVER_OPTION_PROXY: + if (value && value[0]) + { + proxy_found = 0; + infolist = weechat_infolist_get ("proxy", NULL, value); + if (infolist) + { + while (weechat_infolist_next (infolist)) + { + proxy_name = weechat_infolist_string (infolist, "name"); + if (proxy_name && (strcmp (value, proxy_name) == 0)) + { + proxy_found = 1; + break; + } + } + weechat_infolist_free (infolist); + } + if (!proxy_found) + { + weechat_printf (NULL, + _("%s%s: warning: proxy \"%s\" does not " + "exist (you can create it with command " + "/proxy)"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, + value); + } + } + break; case IRC_SERVER_OPTION_SSL_PRIORITIES: pos_error = irc_config_check_gnutls_priorities (value); if (pos_error) @@ -1455,7 +1485,8 @@ irc_config_server_new_option (struct t_config_file *config_file, new_option = weechat_config_new_option ( config_file, section, option_name, "string", - N_("proxy used for this server (optional)"), + N_("name of proxy used for this server (optional, proxy must be " + "defined with command /proxy)"), NULL, 0, 0, default_value, value, null_value_allowed, |