From fe7f92c4d8fbeac3257ac36af8491bce3dc32033 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Fri, 6 Jan 2017 22:44:13 +0100 Subject: [PATCH] irc: fix option "-temp" in command /server (closes #880) --- ChangeLog.adoc | 1 + src/plugins/irc/irc-command.c | 7 +++++-- src/plugins/irc/irc-server.c | 34 +++++++++++++++++++++------------- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 3ed5ed728..7948ab635 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -47,6 +47,7 @@ Bug fixes:: * core: fix display of empty lines in search mode (issue #829) * api: fix crash in function string_expand_home() when the HOME environment variable is not set (issue #827) * exec: fix memory leak in display of process output + * irc: fix option "-temp" in command /server (issue #880) * irc: fix close of server channels which are waiting for the JOIN when the server buffer is closed (issue #873) * irc: fix buffer switching on manual join for forwarded channels (issue #876) * irc: add missing tags on CTCP message sent diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c index b157f62fb..4c79dfea4 100644 --- a/src/plugins/irc/irc-command.c +++ b/src/plugins/irc/irc-command.c @@ -1295,8 +1295,8 @@ IRC_COMMAND_CALLBACK(connect) argv[i], 1); weechat_printf ( NULL, - _("%s: server %s%s%s added (temporary " - "server, NOT SAVED!)"), + _("%s: server %s%s%s added " + "(temporary server, NOT SAVED!)"), IRC_PLUGIN_NAME, IRC_COLOR_CHAT_SERVER, ptr_server->name, @@ -5010,6 +5010,9 @@ IRC_COMMAND_CALLBACK(server) weechat_printf ( NULL, + (new_server->temp_server) ? + _("%s: server %s%s%s added " + "(temporary server, NOT SAVED!)") : _("%s: server %s%s%s added"), IRC_PLUGIN_NAME, IRC_COLOR_CHAT_SERVER, diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c index d2a9d6ab8..1218ef785 100644 --- a/src/plugins/irc/irc-server.c +++ b/src/plugins/irc/irc-server.c @@ -1403,22 +1403,30 @@ irc_server_apply_command_line_options (struct t_irc_server *server, } if (option_name) { - index_option = irc_server_search_option (option_name); - if (index_option < 0) + if (weechat_strcasecmp (option_name, "temp") == 0) { - /* look if option is negative, like "-noxxx" */ - if (weechat_strncasecmp (argv[i], "-no", 3) == 0) - { - free (option_name); - option_name = strdup (argv[i] + 3); - index_option = irc_server_search_option (option_name); - ptr_value = value_boolean[0]; - } + /* temporary server, not saved */ + server->temp_server = 1; } - if (index_option >= 0) + else { - weechat_config_option_set (server->options[index_option], - ptr_value, 1); + index_option = irc_server_search_option (option_name); + if (index_option < 0) + { + /* look if option is negative, like "-noxxx" */ + if (weechat_strncasecmp (argv[i], "-no", 3) == 0) + { + free (option_name); + option_name = strdup (argv[i] + 3); + index_option = irc_server_search_option (option_name); + ptr_value = value_boolean[0]; + } + } + if (index_option >= 0) + { + weechat_config_option_set (server->options[index_option], + ptr_value, 1); + } } free (option_name); }