diff options
author | Peter Powell <petpow@saberuk.com> | 2018-04-07 15:07:24 +0100 |
---|---|---|
committer | Peter Powell <petpow@saberuk.com> | 2018-04-08 16:54:27 +0100 |
commit | 454c8d374955d2ffb3ec1fca39a6efc32032c649 (patch) | |
tree | eba7066c77408fb909c74154bcf52df34c0911a9 /src | |
parent | 8c0426116cdf09e807da12b6b23d977c4a073119 (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')
-rw-r--r-- | src/coremods/core_stats.cpp | 14 | ||||
-rw-r--r-- | src/coremods/core_whowas.cpp | 7 | ||||
-rw-r--r-- | src/modules.cpp | 1 | ||||
-rw-r--r-- | src/modules/extra/m_geoip.cpp | 6 | ||||
-rw-r--r-- | src/modules/m_cban.cpp | 7 | ||||
-rw-r--r-- | src/modules/m_dnsbl.cpp | 6 | ||||
-rw-r--r-- | src/modules/m_filter.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_hideoper.cpp | 6 | ||||
-rw-r--r-- | src/modules/m_rline.cpp | 8 | ||||
-rw-r--r-- | src/modules/m_shun.cpp | 7 | ||||
-rw-r--r-- | src/modules/m_spanningtree/main.cpp | 5 | ||||
-rw-r--r-- | src/modules/m_spanningtree/main.h | 3 | ||||
-rw-r--r-- | src/modules/m_svshold.cpp | 7 | ||||
-rw-r--r-- | src/xline.cpp | 1 |
14 files changed, 60 insertions, 22 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) { } diff --git a/src/modules.cpp b/src/modules.cpp index ec793c64f..5f8439c44 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -107,7 +107,6 @@ ModResult Module::OnCheckLimit(User*, Channel*) { DetachEvent(I_OnCheckLimit); r ModResult Module::OnCheckChannelBan(User*, Channel*) { DetachEvent(I_OnCheckChannelBan); return MOD_RES_PASSTHRU; } ModResult Module::OnCheckBan(User*, Channel*, const std::string&) { DetachEvent(I_OnCheckBan); return MOD_RES_PASSTHRU; } ModResult Module::OnExtBanCheck(User*, Channel*, char) { DetachEvent(I_OnExtBanCheck); return MOD_RES_PASSTHRU; } -ModResult Module::OnStats(Stats::Context&) { DetachEvent(I_OnStats); return MOD_RES_PASSTHRU; } ModResult Module::OnChangeLocalUserHost(LocalUser*, const std::string&) { DetachEvent(I_OnChangeLocalUserHost); return MOD_RES_PASSTHRU; } ModResult Module::OnChangeLocalUserGECOS(LocalUser*, const std::string&) { DetachEvent(I_OnChangeLocalUserGECOS); return MOD_RES_PASSTHRU; } ModResult Module::OnPreTopicChange(User*, Channel*, const std::string&) { DetachEvent(I_OnPreTopicChange); return MOD_RES_PASSTHRU; } diff --git a/src/modules/extra/m_geoip.cpp b/src/modules/extra/m_geoip.cpp index 35efc8d70..b6b0c3fa1 100644 --- a/src/modules/extra/m_geoip.cpp +++ b/src/modules/extra/m_geoip.cpp @@ -27,6 +27,7 @@ #include "inspircd.h" #include "xline.h" +#include "modules/stats.h" // Fix warnings about the use of commas at end of enumerator lists on C++03. #if defined __clang__ @@ -47,7 +48,7 @@ enum RPL_WHOISCOUNTRY = 344 }; -class ModuleGeoIP : public Module, public Whois::EventListener +class ModuleGeoIP : public Module, public Stats::EventListener, public Whois::EventListener { StringExtItem ext; bool extban; @@ -65,7 +66,8 @@ class ModuleGeoIP : public Module, public Whois::EventListener public: ModuleGeoIP() - : Whois::EventListener(this) + : Stats::EventListener(this) + , Whois::EventListener(this) , ext("geoip_cc", ExtensionItem::EXT_USER, this) , extban(true) , gi(NULL) diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp index 54b1e39ee..7235a8bef 100644 --- a/src/modules/m_cban.cpp +++ b/src/modules/m_cban.cpp @@ -22,6 +22,7 @@ #include "inspircd.h" #include "xline.h" +#include "modules/stats.h" /** Holds a CBAN item */ @@ -140,13 +141,15 @@ class CommandCBan : public Command } }; -class ModuleCBan : public Module +class ModuleCBan : public Module, public Stats::EventListener { CommandCBan mycommand; CBanFactory f; public: - ModuleCBan() : mycommand(this) + ModuleCBan() + : Stats::EventListener(this) + , mycommand(this) { } diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index 732717ff3..ab24873ce 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -24,6 +24,7 @@ #include "inspircd.h" #include "xline.h" #include "modules/dns.h" +#include "modules/stats.h" /* Class holding data for a single entry */ class DNSBLConfEntry : public refcountbase @@ -220,7 +221,7 @@ class DNSBLResolver : public DNS::Request } }; -class ModuleDNSBL : public Module +class ModuleDNSBL : public Module, public Stats::EventListener { std::vector<reference<DNSBLConfEntry> > DNSBLConfEntries; dynamic_reference<DNS::Manager> DNS; @@ -247,7 +248,8 @@ class ModuleDNSBL : public Module } public: ModuleDNSBL() - : DNS(this, "DNS") + : Stats::EventListener(this) + , DNS(this, "DNS") , nameExt("dnsbl_match", ExtensionItem::EXT_USER, this) , countExt("dnsbl_pending", ExtensionItem::EXT_USER, this) { diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index 8ad692971..d3d3ef218 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -25,6 +25,7 @@ #include "modules/regex.h" #include "modules/server.h" #include "modules/shun.h" +#include "modules/stats.h" enum FilterFlags { @@ -160,7 +161,7 @@ class CommandFilter : public Command } }; -class ModuleFilter : public Module, public ServerEventListener +class ModuleFilter : public Module, public ServerEventListener, public Stats::EventListener { typedef insp::flat_set<std::string, irc::insensitive_swo> ExemptTargetSet; @@ -302,6 +303,7 @@ bool ModuleFilter::AppliesToMe(User* user, FilterResult* filter, int iflags) ModuleFilter::ModuleFilter() : ServerEventListener(this) + , Stats::EventListener(this) , initing(true) , filtcommand(this) , RegexEngine(this, "regex") diff --git a/src/modules/m_hideoper.cpp b/src/modules/m_hideoper.cpp index 2e0b388cf..6ecfc6074 100644 --- a/src/modules/m_hideoper.cpp +++ b/src/modules/m_hideoper.cpp @@ -20,6 +20,7 @@ #include "inspircd.h" +#include "modules/stats.h" /** Handles user mode +H */ @@ -48,13 +49,14 @@ class HideOper : public SimpleUserModeHandler } }; -class ModuleHideOper : public Module, public Whois::LineEventListener +class ModuleHideOper : public Module, public Stats::EventListener, public Whois::LineEventListener { HideOper hm; bool active; public: ModuleHideOper() - : Whois::LineEventListener(this) + : Stats::EventListener(this) + , Whois::LineEventListener(this) , hm(this) , active(false) { diff --git a/src/modules/m_rline.cpp b/src/modules/m_rline.cpp index 9bb1167f5..e3a84397f 100644 --- a/src/modules/m_rline.cpp +++ b/src/modules/m_rline.cpp @@ -22,6 +22,7 @@ #include "inspircd.h" #include "modules/regex.h" +#include "modules/stats.h" #include "xline.h" static bool ZlineOnMatch = false; @@ -206,7 +207,7 @@ class CommandRLine : public Command } }; -class ModuleRLine : public Module +class ModuleRLine : public Module, public Stats::EventListener { dynamic_reference<RegexFactory> rxfactory; RLineFactory f; @@ -217,7 +218,10 @@ class ModuleRLine : public Module public: ModuleRLine() - : rxfactory(this, "regex"), f(rxfactory), r(this, f) + : Stats::EventListener(this) + , rxfactory(this, "regex") + , f(rxfactory) + , r(this, f) , initing(true) { } diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp index 5b0b42cae..92c0b0bd0 100644 --- a/src/modules/m_shun.cpp +++ b/src/modules/m_shun.cpp @@ -23,6 +23,7 @@ #include "inspircd.h" #include "xline.h" #include "modules/shun.h" +#include "modules/stats.h" /** An XLineFactory specialized to generate shun pointers @@ -133,7 +134,7 @@ class CommandShun : public Command } }; -class ModuleShun : public Module +class ModuleShun : public Module, public Stats::EventListener { CommandShun cmd; ShunFactory f; @@ -142,7 +143,9 @@ class ModuleShun : public Module bool affectopers; public: - ModuleShun() : cmd(this) + ModuleShun() + : Stats::EventListener(this) + , cmd(this) { } diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 1a77237bd..2fd578698 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -37,7 +37,10 @@ #include "translate.h" ModuleSpanningTree::ModuleSpanningTree() - : rconnect(this), rsquit(this), map(this) + : Stats::EventListener(this) + , rconnect(this) + , rsquit(this) + , map(this) , commands(this) , currmembid(0) , eventprov(this, "event/server") diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h index 4eefb01a0..5add15e8a 100644 --- a/src/modules/m_spanningtree/main.h +++ b/src/modules/m_spanningtree/main.h @@ -26,6 +26,7 @@ #include "inspircd.h" #include "event.h" #include "modules/dns.h" +#include "modules/stats.h" #include "servercommand.h" #include "commands.h" #include "protocolinterface.h" @@ -52,7 +53,7 @@ class Autoconnect; /** This is the main class for the spanningtree module */ -class ModuleSpanningTree : public Module +class ModuleSpanningTree : public Module, public Stats::EventListener { /** Client to server commands, registered in the core */ diff --git a/src/modules/m_svshold.cpp b/src/modules/m_svshold.cpp index 1ba16f3f4..481a1aaba 100644 --- a/src/modules/m_svshold.cpp +++ b/src/modules/m_svshold.cpp @@ -22,6 +22,7 @@ #include "inspircd.h" #include "xline.h" +#include "modules/stats.h" namespace { @@ -161,14 +162,16 @@ class CommandSvshold : public Command } }; -class ModuleSVSHold : public Module +class ModuleSVSHold : public Module, public Stats::EventListener { CommandSvshold cmd; SVSHoldFactory s; public: - ModuleSVSHold() : cmd(this) + ModuleSVSHold() + : Stats::EventListener(this) + , cmd(this) { } diff --git a/src/xline.cpp b/src/xline.cpp index 8d4c822aa..dfd7e2903 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -23,6 +23,7 @@ #include "inspircd.h" #include "xline.h" +#include "modules/stats.h" /** An XLineFactory specialized to generate GLine* pointers */ |