]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/coremods/core_stats.cpp
Use an oper priv instead of a config flag for overriding nonicks.
[user/henk/code/inspircd.git] / src / coremods / core_stats.cpp
index 878ea2fae70c2e88debe207b7348a541283998cf..5642cd52ee64be5c13a3e25bbb9532bf5e0a8bfd 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "inspircd.h"
 #include "xline.h"
+#include "modules/stats.h"
 
 #ifdef _WIN32
 #include <psapi.h>
  */
 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");
@@ -309,10 +319,10 @@ void CommandStats::DoStats(Stats::Context& stats)
                /* stats o */
                case 'o':
                {
-                       ConfigTagList tags = ServerInstance->Config->ConfTags("oper");
-                       for(ConfigIter i = tags.first; i != tags.second; ++i)
+                       for (ServerConfig::OperIndex::const_iterator i = ServerInstance->Config->oper_blocks.begin(); i != ServerInstance->Config->oper_blocks.end(); ++i)
                        {
-                               ConfigTag* tag = i->second;
+                               OperInfo* ifo = i->second;
+                               ConfigTag* tag = ifo->oper_block;
                                stats.AddRow(243, 'O', tag->getString("host"), '*', tag->getString("name"), tag->getString("type"), '0');
                        }
                }