]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/inspircd.cpp
Change cmd_*.so to use the Module object API
[user/henk/code/inspircd.git] / src / inspircd.cpp
index 17fa2ce817ec5046a56678791835bc2d8f750d65..810c477f8e8ab721d6fc96c895674a87efdf8dbf 100644 (file)
@@ -12,8 +12,8 @@
  */
 
 /* $Core */
-/* $Install: src/inspircd $(BINPATH) */
 #include "inspircd.h"
+#include "inspircd_version.h"
 #include <signal.h>
 
 #ifndef WIN32
@@ -82,7 +82,7 @@ const char* ExitCodes[] =
                "CreateEvent failed" /* 19 */
 };
 
-template<typename T> static void DeleteZero(T* n)
+template<typename T> static void DeleteZero(T*&n)
 {
        if (n != NULL)
        {
@@ -126,8 +126,6 @@ void InspIRCd::Cleanup()
                        this->Modules->Unload(k->c_str());
                }
        }
-       /* Remove core commands */
-       Parser->RemoveCommands("<core>");
 
        /* Cleanup Server Names */
        for(servernamelist::iterator itr = servernames.begin(); itr != servernames.end(); ++itr)
@@ -135,6 +133,7 @@ void InspIRCd::Cleanup()
 
        /* Delete objects dynamically allocated in constructor (destructor would be more appropriate, but we're likely exiting) */
        /* Must be deleted before modes as it decrements modelines */
+       DeleteZero(this->FakeClient);
        DeleteZero(this->Users);
        DeleteZero(this->Modes);
        DeleteZero(this->XLines);
@@ -149,6 +148,7 @@ void InspIRCd::Cleanup()
        DeleteZero(this->PI);
        DeleteZero(this->Threads);
        DeleteZero(this->Timers);
+       DeleteZero(this->SE);
        /* Close logging */
        this->Logs->CloseLogs();
        DeleteZero(this->Logs);
@@ -315,9 +315,7 @@ void InspIRCd::WritePID(const std::string &filename)
        }
 }
 
-InspIRCd::InspIRCd(int argc, char** argv)
-       : GlobalCulls(this),
-
+InspIRCd::InspIRCd(int argc, char** argv) :
         /* Functor initialisation. Note that the ordering here is very important.
          *
          * THIS MUST MATCH ORDER OF DECLARATION OF THE HandleWhateverFunc classes
@@ -378,9 +376,6 @@ InspIRCd::InspIRCd(int argc, char** argv)
        // Initialise TIME
        this->TIME = time(NULL);
 
-       memset(&server, 0, sizeof(server));
-       memset(&client, 0, sizeof(client));
-
        // This must be created first, so other parts of Insp can use it while starting up
        this->Logs = new LogManager(this);
 
@@ -465,7 +460,7 @@ InspIRCd::InspIRCd(int argc, char** argv)
                        default:
                                /* Fall through to handle other weird values too */
                                printf("Unknown parameter '%s'\n", argv[optind-1]);
-                               printf("Usage: %s [--nofork] [--nolog] [--debug] [--logfile <filename>]\n%*s[--runasroot] [--version] [--config <config>] [--testsuite]\n", argv[0], 8+strlen(argv[0]), " ");
+                               printf("Usage: %s [--nofork] [--nolog] [--debug] [--logfile <filename>]\n%*s[--runasroot] [--version] [--config <config>] [--testsuite]\n", argv[0], static_cast<int>(8+strlen(argv[0])), " ");
                                Exit(EXIT_STATUS_ARGV);
                        break;
                }
@@ -574,9 +569,6 @@ InspIRCd::InspIRCd(int argc, char** argv)
        this->Config->Apply(NULL, "");
        Logs->OpenFileLogs();
 
-       /** Note: This is safe, the method checks for user == NULL */
-       this->Parser->SetupCommandTable();
-
        this->Res = new DNS(this);
 
        this->AddServerName(Config->ServerName);
@@ -869,12 +861,9 @@ void InspIRCd::BufferedSocketCull()
  */
 bool InspIRCd::AllModulesReportReady(User* user)
 {
-       for (EventHandlerIter i = Modules->EventHandlers[I_OnCheckReady].begin(); i != Modules->EventHandlers[I_OnCheckReady].end(); ++i)
-       {
-               if (!(*i)->OnCheckReady(user))
-                       return false;
-       }
-       return true;
+       ModResult res;
+       FIRST_MOD_RESULT(this, OnCheckReady, res, (user));
+       return (res == MOD_RES_PASSTHRU);
 }
 
 time_t InspIRCd::Time()