diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2014-09-04 07:39:05 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2014-09-04 07:39:05 +0200 |
commit | 761ac5d0e98c06c27a3280fdac7e85fd2082d40f (patch) | |
tree | 582c75b9adba83613959562ba66b44b87fbc3d34 /src/plugins | |
parent | 4c49113036feb9efbd39ac58952e4e753fa6611f (diff) | |
download | weechat-761ac5d0e98c06c27a3280fdac7e85fd2082d40f.zip |
irc: disable creation of temporary servers by default with command /connect, new option irc.look.temporary_servers
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/irc/irc-command.c | 25 | ||||
-rw-r--r-- | src/plugins/irc/irc-config.c | 7 | ||||
-rw-r--r-- | src/plugins/irc/irc-config.h | 1 |
3 files changed, 30 insertions, 3 deletions
diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c index 109f38b6c..05885c6ed 100644 --- a/src/plugins/irc/irc-command.c +++ b/src/plugins/irc/irc-command.c @@ -1172,7 +1172,7 @@ irc_command_connect (void *data, struct t_gui_buffer *buffer, int argc, connect_ok = 0; } } - else + else if (weechat_config_boolean (irc_config_look_temporary_servers)) { if ((strncmp (argv[i], "irc", 3) == 0) && strstr (argv[i], "://")) @@ -1222,6 +1222,24 @@ irc_command_connect (void *data, struct t_gui_buffer *buffer, int argc, IRC_PLUGIN_NAME, argv[i]); } } + else + { + weechat_printf ( + NULL, + _("%s%s: unable to create temporary server \"%s\" " + "because the creation of temporary servers with " + "command /connect is currently disabled"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, argv[i]); + weechat_printf ( + NULL, + _("%s%s: if you want to create a standard server, " + "use the command \"/server add\" (see /help " + "server); if you really want to create a temporary " + "server (NOT SAVED), turn on the option " + "irc.look.temporary_servers"), + weechat_prefix ("error"), + IRC_PLUGIN_NAME); + } } else { @@ -5873,10 +5891,11 @@ irc_command_init () N_(" server: server name, which can be:\n" " - internal server name (created by /server add, " "recommended usage)\n" - " - hostname/port or IP/port (this will create a TEMPORARY " - "server), port is 6667 by default\n" + " - hostname/port or IP/port, port is 6667 by default\n" " - URL with format: irc[6][s]://[nickname[:password]@]" "irc.example.org[:port][/#channel1][,#channel2[...]]\n" + " Note: for an address/IP/URL, a temporary server is " + "created (NOT SAVED), see /help irc.look.temporary_servers\n" " option: set option for server (for boolean option, value can be " "omitted)\n" " nooption: set boolean option to 'off' (for example: -nossl)\n" diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c index 1d6587099..d8b91abaf 100644 --- a/src/plugins/irc/irc-config.c +++ b/src/plugins/irc/irc-config.c @@ -103,6 +103,7 @@ struct t_config_option *irc_config_look_smart_filter_join_unmask; struct t_config_option *irc_config_look_smart_filter_mode; struct t_config_option *irc_config_look_smart_filter_nick; struct t_config_option *irc_config_look_smart_filter_quit; +struct t_config_option *irc_config_look_temporary_servers; struct t_config_option *irc_config_look_topic_strip_colors; /* IRC config, color section */ @@ -2677,6 +2678,12 @@ irc_config_init () /* TRANSLATORS: please do not translate "part" and "quit" */ N_("enable smart filter for \"part\" and \"quit\" messages"), NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_temporary_servers = weechat_config_new_option ( + irc_config_file, ptr_section, + "temporary_servers", "boolean", + N_("enable creation of temporary servers with command " + "/connect"), + NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); irc_config_look_topic_strip_colors = weechat_config_new_option ( irc_config_file, ptr_section, "topic_strip_colors", "boolean", diff --git a/src/plugins/irc/irc-config.h b/src/plugins/irc/irc-config.h index 7da924010..75dd374fd 100644 --- a/src/plugins/irc/irc-config.h +++ b/src/plugins/irc/irc-config.h @@ -151,6 +151,7 @@ extern struct t_config_option *irc_config_look_smart_filter_join_unmask; extern struct t_config_option *irc_config_look_smart_filter_mode; extern struct t_config_option *irc_config_look_smart_filter_nick; extern struct t_config_option *irc_config_look_smart_filter_quit; +extern struct t_config_option *irc_config_look_temporary_servers; extern struct t_config_option *irc_config_look_topic_strip_colors; extern struct t_config_option *irc_config_color_input_nick; |