From 7c805aa699a70800049e1e9760b5bdde84e62be3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Wed, 12 Jul 2023 19:13:40 +0200 Subject: [PATCH] irc: remove default CTCP replies FINGER and USERINFO (issue #1974) --- ChangeLog.adoc | 3 ++- ReleaseNotes.adoc | 16 ++++++++++++++++ src/plugins/irc/irc-command.h | 2 +- src/plugins/irc/irc-ctcp.c | 6 ++---- tests/unit/plugins/irc/test-irc-ctcp.cpp | 10 +++++----- tests/unit/plugins/irc/test-irc-protocol.cpp | 4 ++-- 6 files changed, 28 insertions(+), 13 deletions(-) diff --git a/ChangeLog.adoc b/ChangeLog.adoc index bb34b59c21c..afc33f3478c 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -25,7 +25,8 @@ New features:: * irc: create default options irc.ctcp.* when file irc.conf is created (issue #1974) * irc: evaluate options irc.ctcp.* (issue #1974) * irc: build dynamically the list of CTCPs supported in reply to "CTCP CLIENTINFO" (issue #1974) - * irc: remove Git revision and compilation date from CTCP VERSION/FINGER reply (issue #1974) + * irc: remove Git revision and compilation date from CTCP VERSION reply (issue #1974) + * irc: remove default CTCP replies FINGER and USERINFO (issue #1974) * trigger: add options `-o`, `-ol`, `-i` and `-il` in command `/trigger list` (issue #1953) Bug fixes:: diff --git a/ReleaseNotes.adoc b/ReleaseNotes.adoc index e04dc107b15..69c6451ac89 100644 --- a/ReleaseNotes.adoc +++ b/ReleaseNotes.adoc @@ -21,6 +21,22 @@ IRC CTCP replies are now evaluated, with the same variables available, so now the syntax is for example `${version}` instead of `$version`. + The existing options `irc.ctcp.*` are automatically converted on upgrade. +In addition, for privacy reasons, these default CTCP replies have been removed: + +- FINGER +- USERINFO + +If ever you want that WeeChat replies to these CTCP requests, you can add them +back with the two following commands: + +---- +/set irc.ctcp.finger "WeeChat ${version}" +/set irc.ctcp.userinfo "${username} (${realname})" +---- + +They will then be advertised in reply to "CTCP CLIENTINFO", which is now built +dynamically with these options. + [[v4.1.0_fset_allowed_values]] === Allowed values for options on fset buffer diff --git a/src/plugins/irc/irc-command.h b/src/plugins/irc/irc-command.h index 937513769fa..589753ea975 100644 --- a/src/plugins/irc/irc-command.h +++ b/src/plugins/irc/irc-command.h @@ -64,7 +64,7 @@ struct t_irc_channel; /* list of supported CTCPs (for completion in command /ctcp) */ #define IRC_COMMAND_CTCP_SUPPORTED_COMPLETION \ - "action|clientinfo|finger|ping|source|time|userinfo|version" + "action|clientinfo|ping|source|time|version" extern void irc_command_away_server (struct t_irc_server *server, const char *arguments, diff --git a/src/plugins/irc/irc-ctcp.c b/src/plugins/irc/irc-ctcp.c index 16872894555..c5568787cbc 100644 --- a/src/plugins/irc/irc-ctcp.c +++ b/src/plugins/irc/irc-ctcp.c @@ -42,10 +42,8 @@ struct t_irc_ctcp_reply irc_ctcp_default_reply[] = { { "clientinfo", "${clientinfo}" }, - { "finger", "WeeChat ${version}" }, { "source", "${download}" }, { "time", "${time}" }, - { "userinfo", "${username} (${realname})" }, { "version", "WeeChat ${version}" }, { NULL, NULL }, }; @@ -572,8 +570,8 @@ irc_ctcp_eval_reply (struct t_irc_server *server, const char *format) return NULL; /* - * $clientinfo: supported CTCP, example: - * ACTION DCC CLIENTINFO FINGER PING SOURCE TIME USERINFO VERSION + * $clientinfo: supported CTCP, example with default config: + * ACTION CLIENTINFO DCC PING SOURCE TIME VERSION */ info = irc_ctcp_get_supported_ctcp (server); if (info) diff --git a/tests/unit/plugins/irc/test-irc-ctcp.cpp b/tests/unit/plugins/irc/test-irc-ctcp.cpp index 6fd4a67753b..76f5340e608 100644 --- a/tests/unit/plugins/irc/test-irc-ctcp.cpp +++ b/tests/unit/plugins/irc/test-irc-ctcp.cpp @@ -125,19 +125,19 @@ TEST(IrcCtcp, IrcCtcpGetSupportedCtcp) server = irc_server_alloc ("server"); CHECK(server); - WEE_TEST_STR("ACTION CLIENTINFO DCC FINGER PING SOURCE TIME USERINFO VERSION", + WEE_TEST_STR("ACTION CLIENTINFO DCC PING SOURCE TIME VERSION", irc_ctcp_get_supported_ctcp (server)); config_file_option_set_with_string ("irc.ctcp.version", ""); - WEE_TEST_STR("ACTION CLIENTINFO DCC FINGER PING SOURCE TIME USERINFO", + WEE_TEST_STR("ACTION CLIENTINFO DCC PING SOURCE TIME", irc_ctcp_get_supported_ctcp (server)); config_file_option_set_with_string ("irc.ctcp.time", ""); - WEE_TEST_STR("ACTION CLIENTINFO DCC FINGER PING SOURCE USERINFO", + WEE_TEST_STR("ACTION CLIENTINFO DCC PING SOURCE", irc_ctcp_get_supported_ctcp (server)); config_file_option_set_with_string ("irc.ctcp.version", "test"); - WEE_TEST_STR("ACTION CLIENTINFO DCC FINGER PING SOURCE USERINFO VERSION", + WEE_TEST_STR("ACTION CLIENTINFO DCC PING SOURCE VERSION", irc_ctcp_get_supported_ctcp (server)); config_file_search_with_string ("irc.ctcp.version", NULL, NULL, &ptr_option, NULL); @@ -179,7 +179,7 @@ TEST(IrcCtcp, IrcCtcpEvalReply) WEE_TEST_STR("abc", irc_ctcp_eval_reply (server, "abc")); /* ${clientinfo} */ - WEE_TEST_STR("ACTION CLIENTINFO DCC FINGER PING SOURCE TIME USERINFO VERSION", + WEE_TEST_STR("ACTION CLIENTINFO DCC PING SOURCE TIME VERSION", irc_ctcp_eval_reply (server, "${clientinfo}")); /* ${version} */ diff --git a/tests/unit/plugins/irc/test-irc-protocol.cpp b/tests/unit/plugins/irc/test-irc-protocol.cpp index a1c7ab49590..d993ceb7ef7 100644 --- a/tests/unit/plugins/irc/test-irc-protocol.cpp +++ b/tests/unit/plugins/irc/test-irc-protocol.cpp @@ -2954,7 +2954,7 @@ TEST(IrcProtocolWithServer, privmsg) CHECK_SRV("--", "CTCP requested by alice: CLIENTINFO", "irc_privmsg,irc_ctcp,host_user@host,log1"); CHECK_SRV("--", "CTCP reply to alice: CLIENTINFO ACTION CLIENTINFO " - "DCC FINGER PING SOURCE TIME USERINFO VERSION", + "DCC PING SOURCE TIME VERSION", "irc_privmsg,irc_ctcp,irc_ctcp_reply,self_msg,notify_none," "no_highlight,log1"); } @@ -2971,7 +2971,7 @@ TEST(IrcProtocolWithServer, privmsg) CHECK_SRV("--", "CTCP requested by alice: CLIENTINFO", "irc_privmsg,irc_ctcp,host_user@host,log1"); CHECK_SRV("--", "CTCP reply to alice: CLIENTINFO ACTION CLIENTINFO " - "DCC FINGER PING SOURCE TIME USERINFO VERSION", + "DCC PING SOURCE TIME VERSION", "irc_privmsg,irc_ctcp,irc_ctcp_reply,self_msg,notify_none," "no_highlight,log1"); }