X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_xline_db.cpp;h=404bc6b027de2c2fa33e740b9566b060667e62fa;hb=b71f1affeaa2dbc1d4e5fdf799ab1527a190b0e1;hp=21c75f45e7289b561b5753221badb2f37e05d5ae;hpb=73977e660f8bcb53c3f7363835d94d3bb7ad021a;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_xline_db.cpp b/src/modules/m_xline_db.cpp index 21c75f45e..404bc6b02 100644 --- a/src/modules/m_xline_db.cpp +++ b/src/modules/m_xline_db.cpp @@ -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) {