X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_permchannels.cpp;h=a59518b28d7acb750b47a4bf1c6ef493b087da97;hb=561f4f642e5bc391300dd33989c3624986808ed8;hp=b12b9bbebcdf43e47fee14666ea7607961454ef6;hpb=31de5a7e8f3ed680df6293f96f6b52c1c3a345ef;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp index b12b9bbeb..a59518b28 100644 --- a/src/modules/m_permchannels.cpp +++ b/src/modules/m_permchannels.cpp @@ -172,14 +172,6 @@ public: ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); OnRehash(NULL); - - // Load only when there are no linked servers - we set the TS of the channels we - // create to the current time, this can lead to desync because spanningtree has - // no way of knowing what we do - ProtoServerList serverlist; - ServerInstance->PI->GetServerList(serverlist); - if (serverlist.size() < 2) - LoadDatabase(); } CullResult cull() @@ -300,6 +292,38 @@ public: dirty = false; } + void Prioritize() + { + // XXX: Load the DB here because the order in which modules are init()ed at boot is + // alphabetical, this means we must wait until all modules have done their init() + // to be able to set the modes they provide (e.g.: m_stripcolor is inited after us) + // Prioritize() is called after all module initialization is complete, consequently + // all modes are available now + + static bool loaded = false; + if (loaded) + return; + + loaded = true; + + // Load only when there are no linked servers - we set the TS of the channels we + // create to the current time, this can lead to desync because spanningtree has + // no way of knowing what we do + ProtoServerList serverlist; + ServerInstance->PI->GetServerList(serverlist); + if (serverlist.size() < 2) + { + try + { + LoadDatabase(); + } + catch (CoreException& e) + { + ServerInstance->Logs->Log("m_permchannels", DEFAULT, "Error loading permchannels database: " + std::string(e.GetReason())); + } + } + } + virtual Version GetVersion() { return Version("Provides support for channel mode +P to provide permanent channels",VF_VENDOR);