]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_xline_db.cpp
Attach to events and register services in init()
[user/henk/code/inspircd.git] / src / modules / m_xline_db.cpp
index 21c75f45e7289b561b5753221badb2f37e05d5ae..f25f1d597cc48c060a9441417de9e468c0d5e28d 100644 (file)
@@ -32,7 +32,8 @@ 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);
 
@@ -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)
                {