From 2e0cc3684df72b2a8de45b354848af43c6b47606 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 18 Feb 2020 17:49:32 +0000 Subject: Generalise XLine stats numerics using RPL_STATS from aircd. --- include/numerics.h | 1 + include/xline.h | 17 +++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/numerics.h b/include/numerics.h index baae8de5c..5a05a61eb 100644 --- a/include/numerics.h +++ b/include/numerics.h @@ -50,6 +50,7 @@ enum RPL_ENDMAP = 17, // ircu RPL_MAPUSERS = 18, // insp-specific + RPL_STATS = 210, // From aircd. RPL_UMODEIS = 221, RPL_LUSERCLIENT = 251, diff --git a/include/xline.h b/include/xline.h index 0aaa21a16..fe564358f 100644 --- a/include/xline.h +++ b/include/xline.h @@ -529,14 +529,15 @@ class CoreExport XLineManager */ void ApplyLines(); - /** Handle /STATS for a given type. - * NOTE: Any items in the list for this particular line type which have expired - * will be expired and removed before the list is displayed. - * @param type The type of stats to show - * @param numeric The numeric to give to each result line - * @param stats Stats context - */ - void InvokeStats(const std::string& type, unsigned int numeric, Stats::Context& stats); + /** DEPRECATED: use the `bool InvokeStats(const std::string&, Stats::Context&)` overload instead. */ + DEPRECATED_METHOD(void InvokeStats(const std::string& type, unsigned int numeric, Stats::Context& stats)); + + /** Generates a /STATS response for the given X-line type. + * @param type The type of X-line to look up. + * @param context The stats context to respond with. + * @return True if a response was sent; otherwise, false. + */ + bool InvokeStats(const std::string& type, Stats::Context& context); /** Expire X-lines which were added by the server configuration and have been removed. */ void ExpireRemovedConfigLines(const std::string& type, const insp::flat_set& configlines); -- cgit v1.2.3