summaryrefslogtreecommitdiff
path: root/src/coremods
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2018-04-07 15:07:24 +0100
committerPeter Powell <petpow@saberuk.com>2018-04-08 16:54:27 +0100
commit454c8d374955d2ffb3ec1fca39a6efc32032c649 (patch)
treeeba7066c77408fb909c74154bcf52df34c0911a9 /src/coremods
parent8c0426116cdf09e807da12b6b23d977c4a073119 (diff)
Move OnStats from the core to a cross-module event.
Some core code still exists in the XLine system but this will be replaced when the XLine system is replaced later.
Diffstat (limited to 'src/coremods')
-rw-r--r--src/coremods/core_stats.cpp14
-rw-r--r--src/coremods/core_whowas.cpp7
2 files changed, 17 insertions, 4 deletions
diff --git a/src/coremods/core_stats.cpp b/src/coremods/core_stats.cpp
index d14aef154..5642cd52e 100644
--- a/src/coremods/core_stats.cpp
+++ b/src/coremods/core_stats.cpp
@@ -21,6 +21,7 @@
#include "inspircd.h"
#include "xline.h"
+#include "modules/stats.h"
#ifdef _WIN32
#include <psapi.h>
@@ -31,11 +32,20 @@
*/
class CommandStats : public Command
{
+ Events::ModuleEventProvider statsevprov;
void DoStats(Stats::Context& stats);
+
public:
/** Constructor for stats.
*/
- CommandStats ( Module* parent) : Command(parent,"STATS",1,2) { allow_empty_last_param = false; syntax = "<stats-symbol> [<servername>]"; }
+ CommandStats(Module* Creator)
+ : Command(Creator, "STATS", 1, 2)
+ , statsevprov(Creator, "event/stats")
+ {
+ allow_empty_last_param = false;
+ syntax = "<stats-symbol> [<servername>]";
+ }
+
/** Handle command.
* @param parameters The parameters to the command
* @param user The user issuing the command
@@ -82,7 +92,7 @@ void CommandStats::DoStats(Stats::Context& stats)
}
ModResult MOD_RESULT;
- FIRST_MOD_RESULT(OnStats, MOD_RESULT, (stats));
+ FIRST_MOD_RESULT_CUSTOM(statsevprov, Stats::EventListener, OnStats, MOD_RESULT, (stats));
if (MOD_RESULT == MOD_RES_DENY)
{
stats.AddRow(219, statschar, "End of /STATS report");
diff --git a/src/coremods/core_whowas.cpp b/src/coremods/core_whowas.cpp
index f456a57db..689340a8d 100644
--- a/src/coremods/core_whowas.cpp
+++ b/src/coremods/core_whowas.cpp
@@ -22,6 +22,7 @@
#include "inspircd.h"
#include "commands/cmd_whowas.h"
+#include "modules/stats.h"
enum
{
@@ -260,12 +261,14 @@ WhoWas::Nick::~Nick()
stdalgo::delete_all(entries);
}
-class ModuleWhoWas : public Module
+class ModuleWhoWas : public Module, public Stats::EventListener
{
CommandWhowas cmd;
public:
- ModuleWhoWas() : cmd(this)
+ ModuleWhoWas()
+ : Stats::EventListener(this)
+ , cmd(this)
{
}