Allow using SSLINFO with no params to view your own cert details.

This commit is contained in:
Sadie Powell 2023-09-13 07:48:24 +01:00
parent 2e30276817
commit 9adcc16396
2 changed files with 14 additions and 5 deletions

View File

@ -51,12 +51,15 @@ match against the nickname of the network service and the oper type of
the network service.
">
<helptopic key="sslinfo" title="/SSLINFO <chan>|<nick>" value="
<helptopic key="sslinfo" title="/SSLINFO [<chan>|<nick>]" value="
If a channel is specified then display TLS connection information
for users in the specified channel.
If a user is specified then display information on the TLS connection
and certificate of the specified user.
If no target is specified then display information on the TLS
connection and certificate of the executing user.
">
<helptopic key="uninvite" title="/UNINVITE <nick> <channel>" value="

View File

@ -276,19 +276,25 @@ public:
bool operonlyfp;
CommandSSLInfo(Module* Creator)
: SplitCommand(Creator, "SSLINFO", 1)
: SplitCommand(Creator, "SSLINFO")
, sslonlymode(Creator, "sslonly")
, sslapi(Creator)
{
syntax = { "<channel|nick>" };
syntax = { "[<channel|nick>]" };
}
CmdResult HandleLocal(LocalUser* user, const Params& parameters) override
{
if (parameters.empty())
{
HandleUserInternal(user, user, true);
return CmdResult::SUCCESS;
}
if (ServerInstance->Channels.IsPrefix(parameters[0][0]))
return HandleChannel(user, parameters[0]);
else
return HandleUser(user, parameters[0]);
return HandleUser(user, parameters[0]);
}
};