summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2010-01-14 10:37:10 +0100
committerSebastien Helleu <flashcode@flashtux.org>2010-01-14 10:37:10 +0100
commit4209930399229f0e5170fb13b0edcf20850d2c43 (patch)
tree2388aa6fff5dd873c8df5c4aab41a7d44c5c2fa2 /src/plugins
parent0e6b33b5bea34ecb89e579ced947b87863466cf6 (diff)
downloadweechat-4209930399229f0e5170fb13b0edcf20850d2c43.zip
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.
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/irc/irc-config.c21
-rw-r--r--src/plugins/irc/irc-config.h3
-rw-r--r--src/plugins/irc/irc-ctcp.c77
3 files changed, 69 insertions, 32 deletions
diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c
index 33d49a8a7..d411ce447 100644
--- a/src/plugins/irc/irc-config.c
+++ b/src/plugins/irc/irc-config.c
@@ -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",
diff --git a/src/plugins/irc/irc-config.h b/src/plugins/irc/irc-config.h
index 7a761f016..18900b1bc 100644
--- a/src/plugins/irc/irc-config.h
+++ b/src/plugins/irc/irc-config.h
@@ -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;
diff --git a/src/plugins/irc/irc-ctcp.c b/src/plugins/irc/irc-ctcp.c
index 2ad11f114..a2aeaff15 100644
--- a/src/plugins/irc/irc-ctcp.c
+++ b/src/plugins/irc/irc-ctcp.c
@@ -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 : "");
+ }
}
}