irc: copy temporary server flag in command /server copy
This commit is contained in:
parent
dcd10657b1
commit
3590302183
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user