]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_xline_db.cpp
Modified m_timedbans to behave more like setting mode +b manually.
[user/henk/code/inspircd.git] / src / modules / m_xline_db.cpp
index 21c75f45e7289b561b5753221badb2f37e05d5ae..404bc6b027de2c2fa33e740b9566b060667e62fa 100644 (file)
@@ -32,9 +32,10 @@ class ModuleXLineDB : public Module
                                                // DO REMEMBER TO SET IT, otherwise it's annoying :P
        std::string xlinedbpath;
  public:
-       ModuleXLineDB()         {
+       void init()
+       {
                Implementation eventlist[] = { I_OnAddLine, I_OnDelLine, I_OnExpireLine };
-               ServerInstance->Modules->Attach(eventlist, this, 3);
+               ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
 
                /* Load the configuration
                 * Note:
@@ -152,6 +153,14 @@ class ModuleXLineDB : public Module
                        return false;
                }
 
+#ifdef _WIN32
+               if (remove(xlinedbpath.c_str()))
+               {
+                       ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: Cannot remove old database! %s (%d)", strerror(errno), errno);
+                       ServerInstance->SNO->WriteToSnoMask('a', "database: cannot remove old database: %s (%d)", strerror(errno), errno);
+                       return false;
+               }
+#endif
                // Use rename to move temporary to new db - this is guarenteed not to fuck up, even in case of a crash.
                if (rename(xlinenewdbpath.c_str(), xlinedbpath.c_str()) < 0)
                {