summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2016-12-11 13:50:38 +0100
committerSébastien Helleu <flashcode@flashtux.org>2016-12-11 13:50:38 +0100
commit36c9317077a468b89d430df71f1c77e838a77c30 (patch)
tree8a3e4fe0d87651aabbf2779a099e2d4763a7965d /src/plugins
parent39a8b9810b8bc62d3e4c912e4f55927a06473fe9 (diff)
downloadweechat-36c9317077a468b89d430df71f1c77e838a77c30.zip
irc: evaluate content of server option "usermode"
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/irc/irc-config.c39
-rw-r--r--src/plugins/irc/irc-protocol.c17
2 files changed, 31 insertions, 25 deletions
diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c
index d21c76230..7f1edc179 100644
--- a/src/plugins/irc/irc-config.c
+++ b/src/plugins/irc/irc-config.c
@@ -1981,6 +1981,26 @@ irc_config_server_new_option (struct t_config_file *config_file,
callback_change_data,
NULL, NULL, NULL);
break;
+ case IRC_SERVER_OPTION_USERMODE:
+ new_option = weechat_config_new_option (
+ config_file, section,
+ option_name, "string",
+ N_("usermode to set after connection to server and before "
+ "executing command and the auto-join of channels; this "
+ "option gives same result as defining a command "
+ "\"/mode $nick <mode>\" "
+ "(note: content is evaluated, see /help eval)"),
+ NULL, 0, 0,
+ default_value, value,
+ null_value_allowed,
+ callback_check_value,
+ callback_check_value_pointer,
+ callback_check_value_data,
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
+ break;
case IRC_SERVER_OPTION_COMMAND:
new_option = weechat_config_new_option (
config_file, section,
@@ -2244,25 +2264,6 @@ irc_config_server_new_option (struct t_config_file *config_file,
callback_change_data,
NULL, NULL, NULL);
break;
- case IRC_SERVER_OPTION_USERMODE:
- new_option = weechat_config_new_option (
- config_file, section,
- option_name, "string",
- N_("usermode to set after connection to server and before "
- "executing command and the auto-join of channels; this "
- "option gives same result as defining a command "
- "\"/mode $nick <mode>\""),
- NULL, 0, 0,
- default_value, value,
- null_value_allowed,
- callback_check_value,
- callback_check_value_pointer,
- callback_check_value_data,
- callback_change,
- callback_change_pointer,
- callback_change_data,
- NULL, NULL, NULL);
- break;
case IRC_SERVER_NUM_OPTIONS:
break;
}
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index d3ebf16c2..5ae43428f 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -2453,7 +2453,7 @@ IRC_PROTOCOL_CALLBACK(wallops)
IRC_PROTOCOL_CALLBACK(001)
{
char *server_command, **commands, **ptr_command, *vars_replaced, *away_msg;
- const char *usermode;
+ char *usermode;
IRC_PROTOCOL_MIN_ARGS(3);
@@ -2494,7 +2494,9 @@ IRC_PROTOCOL_CALLBACK(001)
WEECHAT_HOOK_SIGNAL_STRING, server->name);
/* set usermode when connected */
- usermode = IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_USERMODE);
+ usermode = weechat_string_eval_expression (
+ IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_USERMODE),
+ NULL, NULL, NULL);
if (usermode && usermode[0])
{
irc_server_sendf (server,
@@ -2502,11 +2504,13 @@ IRC_PROTOCOL_CALLBACK(001)
"MODE %s %s",
server->nick, usermode);
}
+ if (usermode)
+ free (usermode);
/* execute command when connected */
- server_command = weechat_string_eval_expression (IRC_SERVER_OPTION_STRING(server,
- IRC_SERVER_OPTION_COMMAND),
- NULL, NULL, NULL);
+ server_command = weechat_string_eval_expression (
+ IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_COMMAND),
+ NULL, NULL, NULL);
if (server_command && server_command[0])
{
/* split command on ';' which can be escaped with '\;' */
@@ -2531,8 +2535,9 @@ IRC_PROTOCOL_CALLBACK(001)
irc_server_autojoin_channels (server);
}
else
+ {
irc_server_autojoin_channels (server);
-
+ }
if (server_command)
free (server_command);