diff options
Diffstat (limited to 'src/plugins/irc/irc-server.c')
-rw-r--r-- | src/plugins/irc/irc-server.c | 53 |
1 files changed, 28 insertions, 25 deletions
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; |