1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-03 00:03:12 +02:00

irc: read local variable "autorejoin" in buffer to override server option "autorejoin" (task #12256)

This commit is contained in:
Nils Görs
2012-12-05 19:39:50 +01:00
committed by Sebastien Helleu
parent d544a47e2c
commit d224594194
19 changed files with 128 additions and 42 deletions
+4 -1
View File
@@ -1631,7 +1631,10 @@ irc_config_server_new_option (struct t_config_file *config_file,
new_option = weechat_config_new_option (
config_file, section,
option_name, "boolean",
N_("automatically rejoin channels after kick"),
N_("automatically rejoin channels after kick; you can define "
"a buffer local variable on a channel to override this "
"value (name of variable: \"autorejoin\", value: \"on\" or "
"\"off\")"),
NULL, 0, 0,
default_value, value,
null_value_allowed,
+16 -1
View File
@@ -631,6 +631,8 @@ IRC_PROTOCOL_CALLBACK(join)
IRC_PROTOCOL_CALLBACK(kick)
{
char *pos_comment;
const char *ptr_autorejoin;
int rejoin;
struct t_irc_channel *ptr_channel;
struct t_irc_nick *ptr_nick, *ptr_nick_kicked;
@@ -696,7 +698,20 @@ IRC_PROTOCOL_CALLBACK(kick)
* more
*/
irc_nick_free_all (server, ptr_channel);
if (IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_AUTOREJOIN))
/* read option "autorejoin" in server */
rejoin = IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_AUTOREJOIN);
/*
* if buffer has a local variable "autorejoin", use it
* (it has higher priority than server option
*/
ptr_autorejoin = weechat_buffer_get_string (ptr_channel->buffer,
"localvar_autorejoin");
if (ptr_autorejoin)
rejoin = weechat_config_string_to_boolean (ptr_autorejoin);
if (rejoin)
{
if (IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_AUTOREJOIN_DELAY) == 0)
{