summaryrefslogtreecommitdiff
path: root/src/plugins/irc/irc-command.c
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2023-05-25 19:22:40 +0200
committerSébastien Helleu <flashcode@flashtux.org>2023-05-25 19:22:40 +0200
commit45fb1ae4bae31abed6e95f11c7cd6f5b9e935680 (patch)
tree4d609a51e29e6a480eb41b5687ff83f269f7442e /src/plugins/irc/irc-command.c
parent3a8525bb95d797804feff5b5188977ac26c40bab (diff)
downloadweechat-45fb1ae4bae31abed6e95f11c7cd6f5b9e935680.zip
irc: hide CTCP messages sent with `/ctcp` when capability "echo-message" is enabled (issue #139)
Diffstat (limited to 'src/plugins/irc/irc-command.c')
-rw-r--r--src/plugins/irc/irc-command.c43
1 files changed, 24 insertions, 19 deletions
diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c
index 7653da188..dc67c030b 100644
--- a/src/plugins/irc/irc-command.c
+++ b/src/plugins/irc/irc-command.c
@@ -1915,25 +1915,30 @@ IRC_COMMAND_CALLBACK(ctcp)
ctcp_type,
(ctcp_args) ? " " : "",
(ctcp_args) ? ctcp_args : "");
- weechat_printf_date_tags (
- irc_msgbuffer_get_target_buffer (
- ptr_server, ctcp_target, NULL, "ctcp", NULL),
- 0,
- irc_protocol_tags (ptr_server,
- "privmsg",
- NULL,
- "irc_ctcp,self_msg,notify_none,no_highlight",
- NULL, NULL),
- _("%sCTCP query to %s%s%s: %s%s%s%s%s"),
- weechat_prefix ("network"),
- irc_nick_color_for_msg (ptr_server, 0, NULL, ctcp_target),
- ctcp_target,
- IRC_COLOR_RESET,
- IRC_COLOR_CHAT_CHANNEL,
- ctcp_type,
- IRC_COLOR_RESET,
- (ctcp_args) ? " " : "",
- (ctcp_args) ? ctcp_args : "");
+ /* display message only if capability "echo-message" is NOT enabled */
+ if (!weechat_hashtable_has_key (ptr_server->cap_list, "echo-message"))
+ {
+ weechat_printf_date_tags (
+ irc_msgbuffer_get_target_buffer (
+ ptr_server, ctcp_target, NULL, "ctcp", NULL),
+ 0,
+ irc_protocol_tags (
+ ptr_server,
+ "privmsg",
+ NULL,
+ "irc_ctcp,self_msg,notify_none,no_highlight",
+ NULL, NULL),
+ _("%sCTCP query to %s%s%s: %s%s%s%s%s"),
+ weechat_prefix ("network"),
+ irc_nick_color_for_msg (ptr_server, 0, NULL, ctcp_target),
+ ctcp_target,
+ IRC_COLOR_RESET,
+ IRC_COLOR_CHAT_CHANNEL,
+ ctcp_type,
+ IRC_COLOR_RESET,
+ (ctcp_args) ? " " : "",
+ (ctcp_args) ? ctcp_args : "");
+ }
}
}