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

Enhancements on IRC CTCP messages (display if CTCP is blocked, new config options to control display of CTCP messages/replies)

That includes:
- display "(blocked)" if CTCP is blocked
- new option "irc.look.display_ctcp_blocked" to display blocked CTCP,
- new option "irc.look.display_ctcp_reply" to display CTCP reply sent by WeeChat,
- new option "irc.look.display_ctcp_unknown" to display unknown CTCP received.
This commit is contained in:
Sebastien Helleu
2010-01-14 10:37:10 +01:00
parent 0e6b33b5be
commit 4209930399
15 changed files with 257 additions and 57 deletions
+21
View File
@@ -56,6 +56,9 @@ struct t_config_option *irc_config_look_nick_suffix;
struct t_config_option *irc_config_look_nick_completion_smart;
struct t_config_option *irc_config_look_display_away;
struct t_config_option *irc_config_look_display_channel_modes;
struct t_config_option *irc_config_look_display_ctcp_blocked;
struct t_config_option *irc_config_look_display_ctcp_reply;
struct t_config_option *irc_config_look_display_ctcp_unknown;
struct t_config_option *irc_config_look_display_nick_modes;
struct t_config_option *irc_config_look_display_old_topic;
struct t_config_option *irc_config_look_hide_nickserv_pwd;
@@ -1360,6 +1363,24 @@ irc_config_init ()
N_("display channel modes in \"buffer_name\" bar item"),
NULL, 0, 0, "on", NULL, 0, NULL, NULL,
&irc_config_change_look_display_channel_modes, NULL, NULL, NULL);
irc_config_look_display_ctcp_blocked = weechat_config_new_option (
irc_config_file, ptr_section,
"display_ctcp_blocked", "boolean",
N_("display CTCP message even if it is blocked"),
NULL, 0, 0, "on", NULL, 0, NULL, NULL,
NULL, NULL, NULL, NULL);
irc_config_look_display_ctcp_reply = weechat_config_new_option (
irc_config_file, ptr_section,
"display_ctcp_reply", "boolean",
N_("display CTCP reply sent by WeeChat"),
NULL, 0, 0, "on", NULL, 0, NULL, NULL,
NULL, NULL, NULL, NULL);
irc_config_look_display_ctcp_unknown = weechat_config_new_option (
irc_config_file, ptr_section,
"display_ctcp_unknown", "boolean",
N_("display CTCP message even if it is unknown CTCP"),
NULL, 0, 0, "on", NULL, 0, NULL, NULL,
NULL, NULL, NULL, NULL);
irc_config_look_display_nick_modes = weechat_config_new_option (
irc_config_file, ptr_section,
"display_nick_modes", "boolean",
+3
View File
@@ -78,6 +78,9 @@ extern struct t_config_option *irc_config_look_nick_suffix;
extern struct t_config_option *irc_config_look_nick_completion_smart;
extern struct t_config_option *irc_config_look_display_away;
extern struct t_config_option *irc_config_look_display_channel_modes;
extern struct t_config_option *irc_config_look_display_ctcp_blocked;
extern struct t_config_option *irc_config_look_display_ctcp_reply;
extern struct t_config_option *irc_config_look_display_ctcp_unknown;
extern struct t_config_option *irc_config_look_display_nick_modes;
extern struct t_config_option *irc_config_look_display_old_topic;
extern struct t_config_option *irc_config_look_hide_nickserv_pwd;
+45 -32
View File
@@ -108,20 +108,27 @@ irc_ctcp_display_request (struct t_irc_server *server,
const char *command,
struct t_irc_channel *channel,
const char *nick, const char *ctcp,
const char *arguments)
const char *arguments,
const char *reply)
{
/* CTCP blocked and user doesn't want to see message? then just return */
if (reply && !reply[0]
&& !weechat_config_boolean (irc_config_look_display_ctcp_blocked))
return;
weechat_printf_tags ((channel) ? channel->buffer : server->buffer,
irc_protocol_tags (command, "irc_ctcp"),
_("%sCTCP requested by %s%s%s: %s%s%s%s%s"),
_("%sCTCP requested by %s%s%s: %s%s%s%s%s%s"),
weechat_prefix ("network"),
IRC_COLOR_CHAT_NICK,
nick,
IRC_COLOR_CHAT,
IRC_COLOR_CHAT_CHANNEL,
ctcp,
(arguments) ? IRC_COLOR_CHAT : "",
IRC_COLOR_CHAT,
(arguments) ? " " : "",
(arguments) ? arguments : "");
(arguments) ? arguments : "",
(reply && !reply[0]) ? _(" (blocked)") : "");
}
/*
@@ -243,19 +250,22 @@ irc_ctcp_reply_to_nick (struct t_irc_server *server,
nick, ctcp,
(arguments) ? " " : "",
(arguments) ? arguments : "");
weechat_printf_tags ((channel) ? channel->buffer : server->buffer,
irc_protocol_tags (command, "irc_ctcp,irc_ctcp_reply"),
_("%sCTCP reply to %s%s%s: %s%s%s%s%s"),
weechat_prefix ("network"),
IRC_COLOR_CHAT_NICK,
nick,
IRC_COLOR_CHAT,
IRC_COLOR_CHAT_CHANNEL,
ctcp,
(arguments) ? IRC_COLOR_CHAT : "",
(arguments) ? " " : "",
(arguments) ? arguments : "");
if (weechat_config_boolean (irc_config_look_display_ctcp_reply))
{
weechat_printf_tags ((channel) ? channel->buffer : server->buffer,
irc_protocol_tags (command, "irc_ctcp,irc_ctcp_reply"),
_("%sCTCP reply to %s%s%s: %s%s%s%s%s"),
weechat_prefix ("network"),
IRC_COLOR_CHAT_NICK,
nick,
IRC_COLOR_CHAT,
IRC_COLOR_CHAT_CHANNEL,
ctcp,
(arguments) ? IRC_COLOR_CHAT : "",
(arguments) ? " " : "",
(arguments) ? arguments : "");
}
}
/*
@@ -899,7 +909,7 @@ irc_ctcp_recv (struct t_irc_server *server, const char *command,
{
reply = irc_ctcp_get_reply (server, arguments + 1);
irc_ctcp_display_request (server, command, channel, nick,
arguments + 1, pos_args);
arguments + 1, pos_args, reply);
if (!reply || reply[0])
{
irc_ctcp_reply_to_nick (server, command, channel, nick,
@@ -918,7 +928,7 @@ irc_ctcp_recv (struct t_irc_server *server, const char *command,
if (reply)
{
irc_ctcp_display_request (server, command, channel, nick,
arguments + 1, pos_args);
arguments + 1, pos_args, reply);
if (reply[0])
{
@@ -933,19 +943,22 @@ irc_ctcp_recv (struct t_irc_server *server, const char *command,
}
else
{
weechat_printf_tags ((channel) ? channel->buffer : server->buffer,
irc_protocol_tags (command, "irc_ctcp"),
_("%sUnknown CTCP requested by %s%s%s: "
"%s%s%s%s%s"),
weechat_prefix ("network"),
IRC_COLOR_CHAT_NICK,
nick,
IRC_COLOR_CHAT,
IRC_COLOR_CHAT_CHANNEL,
arguments + 1,
(pos_args) ? IRC_COLOR_CHAT : "",
(pos_args) ? " " : "",
(pos_args) ? pos_args : "");
if (weechat_config_boolean (irc_config_look_display_ctcp_unknown))
{
weechat_printf_tags ((channel) ? channel->buffer : server->buffer,
irc_protocol_tags (command, "irc_ctcp"),
_("%sUnknown CTCP requested by %s%s%s: "
"%s%s%s%s%s"),
weechat_prefix ("network"),
IRC_COLOR_CHAT_NICK,
nick,
IRC_COLOR_CHAT,
IRC_COLOR_CHAT_CHANNEL,
arguments + 1,
(pos_args) ? IRC_COLOR_CHAT : "",
(pos_args) ? " " : "",
(pos_args) ? pos_args : "");
}
}
}