diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2020-03-08 13:56:30 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2020-03-08 13:56:30 +0100 |
commit | 35903021836f7aa3cc0e800b3d719c2bd06b384c (patch) | |
tree | d21749d8d0f7670f4b9ae568e34e56f2c9d603c5 | |
parent | dcd10657b1385c3dfb7e7dc25bddf2437b87550e (diff) | |
download | weechat-35903021836f7aa3cc0e800b3d719c2bd06b384c.zip |
irc: copy temporary server flag in command /server copy
-rw-r--r-- | ChangeLog.adoc | 1 | ||||
-rw-r--r-- | src/plugins/irc/irc-server.c | 53 |
2 files changed, 29 insertions, 25 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 12d24d101..9256a7f8a 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -33,6 +33,7 @@ Bug fixes:: * core: fix memory leak in completion * core: flush stdout/stderr before forking in hook_process function (issue #1441) * core: fix evaluation of condition with nested "if" (issue #1434) + * irc: copy temporary server flag in command /server copy * irc: add nick changes in the hotlist (except self nick change) * irc: case-insensitive comparison on incoming CTCP command, force upper case on CTCP replies (issue #1439) * irc: fix memory leak when the channel topic is changed diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c index cd6c100d7..436b53c22 100644 --- a/src/plugins/irc/irc-server.c +++ b/src/plugins/irc/irc-server.c @@ -2024,40 +2024,43 @@ irc_server_copy (struct t_irc_server *server, const char *new_name) return NULL; new_server = irc_server_alloc (new_name); - if (new_server) + if (!new_server) + return NULL; + + /* duplicate temporary server flag */ + new_server->temp_server = server->temp_server; + + /* duplicate options */ + length = 32 + strlen (server->name) + 1; + mask = malloc (length); + if (!mask) + return 0; + snprintf (mask, length, "irc.server.%s.*", server->name); + infolist = weechat_infolist_get ("option", NULL, mask); + free (mask); + if (infolist) { - /* duplicate options */ - length = 32 + strlen (server->name) + 1; - mask = malloc (length); - if (!mask) - return 0; - snprintf (mask, length, "irc.server.%s.*", server->name); - infolist = weechat_infolist_get ("option", NULL, mask); - free (mask); - if (infolist) + while (weechat_infolist_next (infolist)) { - while (weechat_infolist_next (infolist)) + if (!weechat_infolist_integer (infolist, "value_is_null")) { - if (!weechat_infolist_integer (infolist, "value_is_null")) + option_name = weechat_infolist_string (infolist, + "option_name"); + pos = strrchr (option_name, '.'); + if (pos) { - option_name = weechat_infolist_string (infolist, - "option_name"); - pos = strrchr (option_name, '.'); - if (pos) + index_option = irc_server_search_option (pos + 1); + if (index_option >= 0) { - index_option = irc_server_search_option (pos + 1); - if (index_option >= 0) - { - weechat_config_option_set ( - new_server->options[index_option], - weechat_infolist_string (infolist, "value"), - 1); - } + weechat_config_option_set ( + new_server->options[index_option], + weechat_infolist_string (infolist, "value"), + 1); } } } - weechat_infolist_free (infolist); } + weechat_infolist_free (infolist); } return new_server; |