From 740e193f599ffcaa0e95926dd805e9a201d9ba78 Mon Sep 17 00:00:00 2001 From: Val Lorentz Date: Sat, 19 Mar 2022 19:13:10 +0100 Subject: [PATCH] Add support for the param of WHOWAS (#1968) Not very useful IMO, but every server but InspIRCd seems to implement it, and it's part of the RFCs: * https://datatracker.ietf.org/doc/html/rfc1459#section-4.5.3 * https://datatracker.ietf.org/doc/html/rfc2812#section-3.6.3 --- docs/conf/helpop.conf.example | 4 +++- src/coremods/core_whowas.cpp | 12 ++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/docs/conf/helpop.conf.example b/docs/conf/helpop.conf.example index e05da8cff..a61a02753 100644 --- a/docs/conf/helpop.conf.example +++ b/docs/conf/helpop.conf.example @@ -419,9 +419,11 @@ server. You should not use it during an established connection. "> - entries; - for (WhoWas::Nick::List::const_reverse_iterator i = list.rbegin(); i != list.rend(); ++i) + WhoWas::Nick::List::const_reverse_iterator last = list.rend(); + if (parameters.size() > 1) + { + size_t count = ConvToNum(parameters[1]); + if (count > 0 && (size_t) std::distance(list.rbegin(), last) > count) + last = list.rbegin() + count; + } + + for (WhoWas::Nick::List::const_reverse_iterator i = list.rbegin(); i != last; ++i) { WhoWas::Entry* u = *i;