+ 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()));
+ }
+ }
+ }
+
+ void ProtoSendMode(void* opaque, TargetTypeFlags type, void* target, const std::vector<std::string>& modes, const std::vector<TranslateType>& translate)
+ {
+ // We never pass an empty modelist but better be sure
+ if (modes.empty())
+ return;
+
+ ListModeData* lm = static_cast<ListModeData*>(opaque);
+
+ // Append the mode letters without the trailing '+' (for example "IIII", "gg")
+ lm->modes.append(modes[0].begin()+1, modes[0].end());
+
+ // Append the parameters
+ for (std::vector<std::string>::const_iterator i = modes.begin()+1; i != modes.end(); ++i)
+ {
+ lm->params += *i;
+ lm->params += ' ';
+ }
+ }
+