Permalink
Browse files

Merge remote-tracking branch 'origin/pr/820'

  • Loading branch information...
2 parents 94cab4d + 03fbb4f commit 50a50d033950a299cac8e44ce24c4fb969a38577 @flashcode flashcode committed Dec 11, 2016
@@ -4858,6 +4858,14 @@ irc_command_display_server (struct t_irc_server *server, int with_detail)
weechat_printf (NULL, " notify . . . . . . . : %s'%s'",
IRC_COLOR_CHAT_VALUE,
weechat_config_string (server->options[IRC_SERVER_OPTION_NOTIFY]));
+ /* umodes*/
+ if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_UMODES]))
+ weechat_printf (NULL, " umodes . . . . . . . : ('%s')",
+ IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_UMODES));
+ else
+ weechat_printf (NULL, " umodes . . . . . . . : %s'%s'",
+ IRC_COLOR_CHAT_VALUE,
+ weechat_config_string (server->options[IRC_SERVER_OPTION_UMODES]));
}
else
{
@@ -2244,6 +2244,23 @@ irc_config_server_new_option (struct t_config_file *config_file,
callback_change_data,
NULL, NULL, NULL);
break;
+ case IRC_SERVER_OPTION_UMODES:
+ new_option = weechat_config_new_option (
+ config_file, section,
+ option_name, "string",
+ N_("umode(s) to set after connection to server and before "
+ "auto-join of channels"),
+ 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;
}
@@ -2453,6 +2453,7 @@ IRC_PROTOCOL_CALLBACK(wallops)
IRC_PROTOCOL_CALLBACK(001)
{
char *server_command, **commands, **ptr_command, *vars_replaced, *away_msg;
+ const char *umodes;
IRC_PROTOCOL_MIN_ARGS(3);
@@ -2492,6 +2493,16 @@ IRC_PROTOCOL_CALLBACK(001)
(void) weechat_hook_signal_send ("irc_server_connected",
WEECHAT_HOOK_SIGNAL_STRING, server->name);
+ /* set umodes when connected */
+ umodes = IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_UMODES);
+ if (umodes && umodes[0])
+ {
+ irc_server_sendf (server,
+ IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
+ "MODE %s %s",
+ server->nick, umodes);
+ }
+
/* execute command when connected */
server_command = weechat_string_eval_expression (IRC_SERVER_OPTION_STRING(server,
IRC_SERVER_OPTION_COMMAND),
@@ -116,6 +116,7 @@ char *irc_server_options[IRC_SERVER_NUM_OPTIONS][2] =
{ "msg_part", "WeeChat ${info:version}" },
{ "msg_quit", "WeeChat ${info:version}" },
{ "notify", "" },
+ { "umodes", "" },
};
char *irc_server_casemapping_string[IRC_SERVER_NUM_CASEMAPPING] =
@@ -5560,6 +5561,9 @@ irc_server_add_to_infolist (struct t_infolist *infolist,
if (!weechat_infolist_new_var_string (ptr_item, "msg_quit",
IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_MSG_QUIT)))
return 0;
+ if (!weechat_infolist_new_var_string (ptr_item, "umodes",
+ IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_UMODES)))
+ return 0;
if (!weechat_infolist_new_var_integer (ptr_item, "temp_server", server->temp_server))
return 0;
if (!weechat_infolist_new_var_integer (ptr_item, "index_current_address", server->index_current_address))
@@ -5931,6 +5935,13 @@ irc_server_print_log ()
else
weechat_log_printf (" msg_quit . . . . . . : '%s'",
weechat_config_string (ptr_server->options[IRC_SERVER_OPTION_MSG_QUIT]));
+ /* umodes */
+ if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_UMODES]))
+ weechat_log_printf (" umodes . . . . . . . : null ('%s')",
+ IRC_SERVER_OPTION_STRING(ptr_server, IRC_SERVER_OPTION_UMODES));
+ else
+ weechat_log_printf (" umodes . . . . . . . : '%s'",
+ weechat_config_string (ptr_server->options[IRC_SERVER_OPTION_UMODES]));
/* other server variables */
weechat_log_printf (" temp_server. . . . . : %d", ptr_server->temp_server);
weechat_log_printf (" reloading_from_config: %d", ptr_server->reloaded_from_config);
@@ -82,6 +82,7 @@ enum t_irc_server_option
IRC_SERVER_OPTION_MSG_PART, /* default part message */
IRC_SERVER_OPTION_MSG_QUIT, /* default quit message */
IRC_SERVER_OPTION_NOTIFY, /* notify list */
+ IRC_SERVER_OPTION_UMODES, /* umodes to set once connected */
/* number of server options */
IRC_SERVER_NUM_OPTIONS,
};

0 comments on commit 50a50d0

Please sign in to comment.