1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-01 23:36:37 +02:00

irc: evaluate content of server option "nicks"

This commit is contained in:
Sébastien Helleu
2015-07-10 20:10:22 +02:00
parent 653a392d9a
commit 14496c41a3
21 changed files with 118 additions and 42 deletions
+2 -1
View File
@@ -1875,7 +1875,8 @@ irc_config_server_new_option (struct t_config_file *config_file,
new_option = weechat_config_new_option (
config_file, section,
option_name, "string",
N_("nicknames to use on server (separated by comma)"),
N_("nicknames to use on server (separated by comma) "
"(note: content is evaluated, see /help eval)"),
NULL, 0, 0,
default_value, value,
null_value_allowed,
+9 -1
View File
@@ -494,6 +494,8 @@ irc_server_set_index_current_address (struct t_irc_server *server, int index)
void
irc_server_set_nicks (struct t_irc_server *server, const char *nicks)
{
char *nicks2;
/* free data */
server->nicks_count = 0;
if (server->nicks_array)
@@ -502,10 +504,16 @@ irc_server_set_nicks (struct t_irc_server *server, const char *nicks)
server->nicks_array = NULL;
}
/* evaluate value */
nicks2 = weechat_string_eval_expression (nicks, NULL, NULL, NULL);
/* set new nicks */
server->nicks_array = weechat_string_split (
(nicks) ? nicks : IRC_SERVER_DEFAULT_NICKS,
(nicks2) ? nicks2 : IRC_SERVER_DEFAULT_NICKS,
",", 0, 0, &server->nicks_count);
if (nicks2)
free (nicks2);
}
/*