summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatti Virkkunen <mvirkkunen@gmail.com>2021-01-30 01:01:51 +0200
committerMatti Virkkunen <mvirkkunen@gmail.com>2021-01-30 01:01:51 +0200
commitbad6dc8a57acfc935425a5467659c553fadb5393 (patch)
tree43417ef94b0e5b70d5c903bfa8d4888a1579ca87
parentdoc: update German documentation (diff)
downloadweechat-bad6dc8a57acfc935425a5467659c553fadb5393.tar.xz
weechat-bad6dc8a57acfc935425a5467659c553fadb5393.zip
irc: make default chantypes configurable
-rw-r--r--ChangeLog.adoc1
-rw-r--r--src/plugins/irc/irc-channel.c11
-rw-r--r--src/plugins/irc/irc-command.c8
-rw-r--r--src/plugins/irc/irc-config.c17
-rw-r--r--src/plugins/irc/irc-server.c1
-rw-r--r--src/plugins/irc/irc-server.h1
6 files changed, 35 insertions, 4 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc
index e49965934..8604829bf 100644
--- a/ChangeLog.adoc
+++ b/ChangeLog.adoc
@@ -26,6 +26,7 @@ New features::
* core: add option "recreate" in command /filter
* core: add evaluation of conditions in evaluation of expressions with "eval_cond:" (issue #1582)
* trigger: add variable "${tg_trigger_name}" in command trigger evaluated strings (issue #1580)
+ * irc: make the default chantypes to use when the server does not specify them configurable (irc.server.xxx.default_chantypes)
Bug fixes::
diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c
index c2bfa4e0c..92f741de7 100644
--- a/src/plugins/irc/irc-channel.c
+++ b/src/plugins/irc/irc-channel.c
@@ -673,10 +673,13 @@ irc_channel_is_channel (struct t_irc_server *server, const char *string)
first_char[0] = string[0];
first_char[1] = '\0';
- return (strpbrk (first_char,
- (server && server->chantypes) ?
- server->chantypes : irc_channel_default_chantypes)) ?
- 1 : 0;
+ return strpbrk(
+ first_char,
+ (server ?
+ (server->chantypes ?
+ server->chantypes :
+ IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_DEFAULT_CHANTYPES))
+ : irc_channel_default_chantypes)) ? 1 : 0;
}
/*
diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c
index 89901e839..1f9deab60 100644
--- a/src/plugins/irc/irc-command.c
+++ b/src/plugins/irc/irc-command.c
@@ -5112,6 +5112,14 @@ irc_command_display_server (struct t_irc_server *server, int with_detail)
weechat_printf (NULL, " charset_message. . . : %s'%s'",
IRC_COLOR_CHAT_VALUE,
weechat_config_string (server->options[IRC_SERVER_OPTION_CHARSET_MESSAGE]));
+ /* chantypes */
+ if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_DEFAULT_CHANTYPES]))
+ weechat_printf (NULL, " chantypes. . . . . . : ('%s')",
+ IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_DEFAULT_CHANTYPES));
+ else
+ weechat_printf (NULL, " chantypes. . . . . . : %s'%s'",
+ IRC_COLOR_CHAT_VALUE,
+ weechat_config_string (server->options[IRC_SERVER_OPTION_DEFAULT_CHANTYPES]));
}
else
{
diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c
index 9e4570534..9975bd964 100644
--- a/src/plugins/irc/irc-config.c
+++ b/src/plugins/irc/irc-config.c
@@ -2434,6 +2434,23 @@ irc_config_server_new_option (struct t_config_file *config_file,
callback_change_data,
NULL, NULL, NULL);
break;
+ case IRC_SERVER_OPTION_DEFAULT_CHANTYPES:
+ new_option = weechat_config_new_option (
+ config_file, section,
+ option_name, "string",
+ N_("channel type prefixes to use if the server does not "
+ "specify them (default is #&)"),
+ 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-server.c b/src/plugins/irc/irc-server.c
index 955e56db5..2695dbff1 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -119,6 +119,7 @@ char *irc_server_options[IRC_SERVER_NUM_OPTIONS][2] =
{ "notify", "" },
{ "split_msg_max_length", "512" },
{ "charset_message", "message" },
+ { "default_chantypes", "#&" },
};
char *irc_server_casemapping_string[IRC_SERVER_NUM_CASEMAPPING] =
diff --git a/src/plugins/irc/irc-server.h b/src/plugins/irc/irc-server.h
index 4583721f1..946a9fa84 100644
--- a/src/plugins/irc/irc-server.h
+++ b/src/plugins/irc/irc-server.h
@@ -92,6 +92,7 @@ enum t_irc_server_option
IRC_SERVER_OPTION_NOTIFY, /* notify list */
IRC_SERVER_OPTION_SPLIT_MSG_MAX_LENGTH, /* max length of messages */
IRC_SERVER_OPTION_CHARSET_MESSAGE, /* what to decode/encode in msg */
+ IRC_SERVER_OPTION_DEFAULT_CHANTYPES, /* chantypes if server doesn't say */
/* number of server options */
IRC_SERVER_NUM_OPTIONS,
};