From 45fb1ae4bae31abed6e95f11c7cd6f5b9e935680 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Thu, 25 May 2023 19:22:40 +0200 Subject: irc: hide CTCP messages sent with `/ctcp` when capability "echo-message" is enabled (issue #139) --- src/plugins/irc/irc-command.c | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) (limited to 'src/plugins/irc/irc-command.c') 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 : ""); + } } } -- cgit v1.2.3