summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugins/irc/irc-command.c9
-rw-r--r--src/plugins/irc/irc-config.c32
-rw-r--r--src/plugins/irc/irc-config.h1
-rw-r--r--src/plugins/irc/irc-server.c37
-rw-r--r--src/plugins/irc/irc-server.h8
5 files changed, 67 insertions, 20 deletions
diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c
index ab88437c3..6a37b3213 100644
--- a/src/plugins/irc/irc-command.c
+++ b/src/plugins/irc/irc-command.c
@@ -5076,7 +5076,6 @@ 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]));
-
/* split_msg_max_length */
if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_SPLIT_MSG_MAX_LENGTH]))
weechat_printf (NULL, " split_msg_max_length : (%d)",
@@ -5085,6 +5084,14 @@ irc_command_display_server (struct t_irc_server *server, int with_detail)
weechat_printf (NULL, " split_msg_max_length : %s%d",
IRC_COLOR_CHAT_VALUE,
weechat_config_integer (server->options[IRC_SERVER_OPTION_SPLIT_MSG_MAX_LENGTH]));
+ /* charset_message */
+ if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_CHARSET_MESSAGE]))
+ weechat_printf (NULL, " charset_message. . . : ('%s')",
+ IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_CHARSET_MESSAGE));
+ else
+ weechat_printf (NULL, " charset_message. . . : %s'%s'",
+ IRC_COLOR_CHAT_VALUE,
+ weechat_config_string (server->options[IRC_SERVER_OPTION_CHARSET_MESSAGE]));
}
else
{
diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c
index 119d2b3c5..2f79614f0 100644
--- a/src/plugins/irc/irc-config.c
+++ b/src/plugins/irc/irc-config.c
@@ -130,7 +130,6 @@ struct t_config_option *irc_config_color_topic_old;
struct t_config_option *irc_config_network_autoreconnect_delay_growing;
struct t_config_option *irc_config_network_autoreconnect_delay_max;
struct t_config_option *irc_config_network_ban_mask_default;
-struct t_config_option *irc_config_network_channel_encode;
struct t_config_option *irc_config_network_colors_receive;
struct t_config_option *irc_config_network_colors_send;
struct t_config_option *irc_config_network_lag_check;
@@ -2394,6 +2393,28 @@ irc_config_server_new_option (struct t_config_file *config_file,
callback_change_data,
NULL, NULL, NULL);
break;
+ case IRC_SERVER_OPTION_CHARSET_MESSAGE:
+ new_option = weechat_config_new_option (
+ config_file, section,
+ option_name, "integer",
+ N_("part of the IRC message (received or sent) which is "
+ "decoded/encoded to the target charset; "
+ "message = the whole IRC message (default), "
+ "channel = starting from the channel name only "
+ "(if found, with fallback on text), "
+ "text = starting from the text only (you should try this "
+ "value if you have issues with the channel name encoding)"),
+ "message|channel|text", 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;
}
@@ -3271,15 +3292,6 @@ irc_config_init ()
"default mask is used only if WeeChat knows the host for the nick"),
NULL, 0, 0, "*!$ident@$host", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
- irc_config_network_channel_encode = weechat_config_new_option (
- irc_config_file, ptr_section,
- "channel_encode", "boolean",
- N_("decode/encode channel name inside messages using charset options; "
- "it is recommended to keep that off if you use only UTF-8 in "
- "channel names; you can enable this option if you are using an "
- "exotic charset like ISO in channel names"),
- NULL, 0, 0, "off", NULL, 0,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_network_colors_receive = weechat_config_new_option (
irc_config_file, ptr_section,
"colors_receive", "boolean",
diff --git a/src/plugins/irc/irc-config.h b/src/plugins/irc/irc-config.h
index b60be4737..36947c216 100644
--- a/src/plugins/irc/irc-config.h
+++ b/src/plugins/irc/irc-config.h
@@ -166,7 +166,6 @@ extern struct t_config_option *irc_config_color_topic_old;
extern struct t_config_option *irc_config_network_autoreconnect_delay_growing;
extern struct t_config_option *irc_config_network_autoreconnect_delay_max;
extern struct t_config_option *irc_config_network_ban_mask_default;
-extern struct t_config_option *irc_config_network_channel_encode;
extern struct t_config_option *irc_config_network_colors_receive;
extern struct t_config_option *irc_config_network_colors_send;
extern struct t_config_option *irc_config_network_lag_check;
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index 1b3737b99..57acf0436 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] =
{ "msg_quit", "WeeChat ${info:version}" },
{ "notify", "" },
{ "split_msg_max_length", "512" },
+ { "charset_message", "message" },
};
char *irc_server_casemapping_string[IRC_SERVER_NUM_CASEMAPPING] =
@@ -2499,10 +2500,19 @@ irc_server_send_one_msg (struct t_irc_server *server, int flags,
msg_encoded = NULL;
irc_message_parse (server, ptr_msg, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, &pos_channel, &pos_text);
- if (weechat_config_boolean (irc_config_network_channel_encode))
- pos_encode = (pos_channel >= 0) ? pos_channel : pos_text;
- else
- pos_encode = pos_text;
+ switch (IRC_SERVER_OPTION_INTEGER(server,
+ IRC_SERVER_OPTION_CHARSET_MESSAGE))
+ {
+ case IRC_SERVER_CHARSET_MESSAGE_MESSAGE:
+ pos_encode = 0;
+ break;
+ case IRC_SERVER_CHARSET_MESSAGE_CHANNEL:
+ pos_encode = (pos_channel >= 0) ? pos_channel : pos_text;
+ break;
+ case IRC_SERVER_CHARSET_MESSAGE_TEXT:
+ pos_encode = pos_text;
+ break;
+ }
if (pos_encode >= 0)
{
ptr_chan_nick = (channel) ? channel : nick;
@@ -3009,10 +3019,21 @@ irc_server_msgq_flush ()
&pos_channel, &pos_text);
msg_decoded = NULL;
- if (weechat_config_boolean (irc_config_network_channel_encode))
- pos_decode = (pos_channel >= 0) ? pos_channel : pos_text;
- else
- pos_decode = pos_text;
+
+
+ switch (IRC_SERVER_OPTION_INTEGER(irc_recv_msgq->server,
+ IRC_SERVER_OPTION_CHARSET_MESSAGE))
+ {
+ case IRC_SERVER_CHARSET_MESSAGE_MESSAGE:
+ pos_decode = 0;
+ break;
+ case IRC_SERVER_CHARSET_MESSAGE_CHANNEL:
+ pos_decode = (pos_channel >= 0) ? pos_channel : pos_text;
+ break;
+ case IRC_SERVER_CHARSET_MESSAGE_TEXT:
+ pos_decode = pos_text;
+ break;
+ }
if (pos_decode >= 0)
{
/* convert charset for message */
diff --git a/src/plugins/irc/irc-server.h b/src/plugins/irc/irc-server.h
index 2f55a15cd..680f406ed 100644
--- a/src/plugins/irc/irc-server.h
+++ b/src/plugins/irc/irc-server.h
@@ -42,6 +42,13 @@ enum t_irc_server_sasl_fail
IRC_SERVER_NUM_SASL_FAIL,
};
+enum t_irc_server_charset_message
+{
+ IRC_SERVER_CHARSET_MESSAGE_MESSAGE = 0,
+ IRC_SERVER_CHARSET_MESSAGE_CHANNEL,
+ IRC_SERVER_CHARSET_MESSAGE_TEXT,
+};
+
enum t_irc_server_option
{
IRC_SERVER_OPTION_ADDRESSES = 0, /* server addresses (IP/name with port) */
@@ -85,6 +92,7 @@ enum t_irc_server_option
IRC_SERVER_OPTION_MSG_QUIT, /* default quit message */
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 */
/* number of server options */
IRC_SERVER_NUM_OPTIONS,
};