Merge branch 'insp3' into master.

This commit is contained in:
Sadie Powell 2022-03-19 18:37:51 +00:00
commit a7de91861f
4 changed files with 21 additions and 11 deletions

View File

@ -417,9 +417,11 @@ server.
You should not use it during an established connection. You should not use it during an established connection.
"> ">
<helpop key="whowas" title="/WHOWAS <nick>" value=" <helpop key="whowas" title="/WHOWAS <nick> [<count>]" value="
Returns a list of times the user was seen recently on IRC along with Returns a list of times the user was seen recently on IRC along with
the time they were last seen and their server. the time they were last seen and their server.
If <count> is given, only return the <count> most recent entries.
"> ">
<helpop key="links" title="/LINKS" value=" <helpop key="links" title="/LINKS" value="

View File

@ -96,7 +96,7 @@ class IRCv3::Batch::Batch final
void Setup(unsigned int b) void Setup(unsigned int b)
{ {
bit = b; bit = b;
reftag = (1 << bit); reftag = (static_cast<RefTag>(1) << bit);
reftagstr = ConvToStr(reftag); reftagstr = ConvToStr(reftag);
} }

View File

@ -186,7 +186,7 @@ public:
CommandWhowas::CommandWhowas( Module* parent) CommandWhowas::CommandWhowas( Module* parent)
: Command(parent, "WHOWAS", 1) : Command(parent, "WHOWAS", 1)
{ {
syntax = { "<nick>" }; syntax = { "<nick> [<count>]" };
Penalty = 2; Penalty = 2;
} }
@ -206,7 +206,15 @@ CmdResult CommandWhowas::Handle(User* user, const Params& parameters)
} }
else else
{ {
for (const auto& u : nick->entries) WhoWas::Nick::List::const_reverse_iterator last = nick->entries.rend();
if (parameters.size() > 1)
{
size_t count = ConvToNum<size_t>(parameters[1]);
if (count > 0 && (size_t) std::distance(nick->entries.rbegin(), last) > count)
last = nick->entries.rbegin() + count;
}
for (const auto& u : insp::iterator_range(nick->entries.rbegin(), last))
{ {
user->WriteNumeric(RPL_WHOWASUSER, parameters[0], u->ident, u->dhost, '*', u->real); user->WriteNumeric(RPL_WHOWASUSER, parameters[0], u->ident, u->dhost, '*', u->real);

View File

@ -1,8 +1,8 @@
# Last updated: 2021-11-08 # Last updated: 2022-03-19
# #
# Modules we can't legally ship: geo_maxmind, ssl_mbedtls, ssl_openssl # Modules we can't legally ship: geo_maxmind, ssl_mbedtls, ssl_openssl
# Modules which don't apply to Windows: regex_posix, sslrehashsgnal # Modules which don't apply to Windows: regex_posix, sslrehashsignal
# Modules without packages: ldap, regex_tre, ssl_gnutls # Modules without packages: ldap, ssl_gnutls
[requires] [requires]
argon2/20190702 argon2/20190702
@ -10,10 +10,10 @@ argon2/20190702
libpq/13.4 libpq/13.4
# mbedtls/3.1.0 # mbedtls/3.1.0
mysql-connector-c/6.1.11 mysql-connector-c/6.1.11
# openssl/3.0.1 # openssl/3.0.2
pcre2/10.37 pcre2/10.39
re2/20211101 re2/20220201
sqlite3/3.37.2 sqlite3/3.38.1
[options] [options]
argon2:shared=True argon2:shared=True