summaryrefslogtreecommitdiff
path: root/include
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 /include
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 'include')
-rw-r--r--include/inspircd.h1
-rw-r--r--include/modules.h9
-rw-r--r--include/modules/stats.h18
3 files changed, 19 insertions, 9 deletions
diff --git a/include/inspircd.h b/include/inspircd.h
index 95da70e54..0f73f192f 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -578,4 +578,3 @@ inline void stdalgo::culldeleter::operator()(classbase* item)
#include "numericbuilder.h"
#include "modules/whois.h"
-#include "modules/stats.h"
diff --git a/include/modules.h b/include/modules.h
index a5e546149..72aa7b4d7 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -220,7 +220,7 @@ enum Implementation
I_OnUserPostNick, I_OnPreMode, I_On005Numeric, I_OnKill, I_OnLoadModule,
I_OnUnloadModule, I_OnBackgroundTimer, I_OnPreCommand, I_OnCheckReady, I_OnCheckInvite,
I_OnRawMode, I_OnCheckKey, I_OnCheckLimit, I_OnCheckBan, I_OnCheckChannelBan, I_OnExtBanCheck,
- I_OnStats, I_OnChangeLocalUserHost, I_OnPreTopicChange,
+ I_OnChangeLocalUserHost, I_OnPreTopicChange,
I_OnPostTopicChange, I_OnPostConnect,
I_OnChangeLocalUserGECOS, I_OnUserRegister, I_OnChannelPreDelete, I_OnChannelDelete,
I_OnPostOper, I_OnSetAway, I_OnPostCommand, I_OnPostJoin,
@@ -815,13 +815,6 @@ class CoreExport Module : public classbase, public usecountbase
*/
virtual ModResult OnExtBanCheck(User* user, Channel* chan, char type);
- /** Called on all /STATS commands
- * This method is triggered for all /STATS use, including stats symbols handled by the core.
- * @param stats Context of the /STATS request, contains requesting user, list of answer rows etc.
- * @return 1 to block the /STATS from being processed by the core, 0 to allow it
- */
- virtual ModResult OnStats(Stats::Context& stats);
-
/** Called whenever a change of a local users displayed host is attempted.
* Return 1 to deny the host change, or 0 to allow it.
* @param user The user whos host will be changed
diff --git a/include/modules/stats.h b/include/modules/stats.h
index d2f6eabbb..e69070c9f 100644
--- a/include/modules/stats.h
+++ b/include/modules/stats.h
@@ -19,12 +19,30 @@
#pragma once
+#include "event.h"
+
namespace Stats
{
class Context;
+ class EventListener;
class Row;
}
+class Stats::EventListener : public Events::ModuleEventListener
+{
+ public:
+ EventListener(Module* mod)
+ : ModuleEventListener(mod, "event/stats")
+ {
+ }
+
+ /** Called when the STATS command is executed.
+ * @param stats Context of the /STATS request, contains requesting user, list of answer rows etc.
+ * @return MOD_RES_DENY if the stats request has been fulfilled. Otherwise, MOD_RES_PASSTHRU.
+ */
+ virtual ModResult OnStats(Stats::Context& stats) = 0;
+};
+
class Stats::Row : public Numeric::Numeric
{
public: