summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2015-07-10 20:10:22 +0200
committerSébastien Helleu <flashcode@flashtux.org>2015-07-10 20:10:22 +0200
commit14496c41a3dfebb49c46c0763dc7119d7b32a323 (patch)
tree94be34db23e3b1649bdea8d2b649d15c6e130861 /src
parent653a392d9a4b0eada338f8249f35b46911bead5d (diff)
downloadweechat-14496c41a3dfebb49c46c0763dc7119d7b32a323.zip
irc: evaluate content of server option "nicks"
Diffstat (limited to 'src')
-rw-r--r--src/plugins/irc/irc-config.c3
-rw-r--r--src/plugins/irc/irc-server.c10
2 files changed, 11 insertions, 2 deletions
diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c
index ccc7147ca..85539eb96 100644
--- a/src/plugins/irc/irc-config.c
+++ b/src/plugins/irc/irc-config.c
@@ -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,
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index 93d5e877f..ad2e8e38f 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -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);
}
/*