Skip to content

Commit

Permalink
irc: remove default CTCP replies FINGER and USERINFO (issue #1974)
Browse files Browse the repository at this point in the history
  • Loading branch information
flashcode committed Jul 12, 2023
1 parent 9237852 commit 7c805aa
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 13 deletions.
3 changes: 2 additions & 1 deletion ChangeLog.adoc
Expand Up @@ -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::
Expand Down
16 changes: 16 additions & 0 deletions ReleaseNotes.adoc
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/irc/irc-command.h
Expand Up @@ -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,
Expand Down
6 changes: 2 additions & 4 deletions src/plugins/irc/irc-ctcp.c
Expand Up @@ -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 },
};
Expand Down Expand Up @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions tests/unit/plugins/irc/test-irc-ctcp.cpp
Expand Up @@ -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);
Expand Down Expand Up @@ -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} */
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/plugins/irc/test-irc-protocol.cpp
Expand Up @@ -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");
}
Expand All @@ -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");
}
Expand Down

0 comments on commit 7c805aa

Please sign in to comment.