diff --git a/znc.cpp b/znc.cpp index 697ccda1..9b222c54 100644 --- a/znc.cpp +++ b/znc.cpp @@ -681,6 +681,7 @@ bool CZNC::WriteNewConfig(const CString& sConfigFile) { #ifdef _MODULES set ssGlobalMods; GetModules().GetAvailableMods(ssGlobalMods, true); + size_t uNrOtherGlobalMods = FilterUncommonModules(ssGlobalMods); if (ssGlobalMods.size()) { CUtils::PrintMessage(""); @@ -705,6 +706,10 @@ bool CZNC::WriteNewConfig(const CString& sConfigFile) { CUtils::PrintMessage(sLine); } + if (uNrOtherGlobalMods > 0) { + CUtils::PrintMessage("And " + CString(uNrOtherGlobalMods) + " other (uncommon) modules. You can enable those later."); + } + CUtils::PrintMessage(""); for (it = ssGlobalMods.begin(); it != ssGlobalMods.end(); it++) { @@ -784,6 +789,7 @@ bool CZNC::WriteNewConfig(const CString& sConfigFile) { #ifdef _MODULES set ssUserMods; GetModules().GetAvailableMods(ssUserMods); + size_t uNrOtherUserMods = FilterUncommonModules(ssUserMods); if (ssUserMods.size()) { vsLines.push_back(""); @@ -809,6 +815,10 @@ bool CZNC::WriteNewConfig(const CString& sConfigFile) { CUtils::PrintMessage(sLine); } + if (uNrOtherUserMods > 0) { + CUtils::PrintMessage("And " + CString(uNrOtherUserMods) + " other (uncommon) modules. You can enable those later."); + } + CUtils::PrintMessage(""); for (it = ssUserMods.begin(); it != ssUserMods.end(); it++) { @@ -948,6 +958,28 @@ bool CZNC::WriteNewConfig(const CString& sConfigFile) { return bFileOpen && CUtils::GetBoolInput("Launch znc now?", true); } +#ifdef _MODULES +size_t CZNC::FilterUncommonModules(set& ssModules) { + const char* ns[] = { "webadmin", "admin", + "chansaver", "keepnick", "simple_away", "partyline", + "kickrejoin", "nickserv", "perform" }; + const set ssNames(ns, ns + sizeof(ns) / sizeof(ns[0])); + + size_t uNrRemoved = 0; + for(set::iterator it = ssModules.begin(); it != ssModules.end(); ) { + if(ssNames.count(it->GetName()) > 0) { + it++; + } else { + set::iterator it2 = it++; + ssModules.erase(it2); + uNrRemoved++; + } + } + + return uNrRemoved; +} +#endif + bool CZNC::ParseConfig(const CString& sConfig) { CString s; diff --git a/znc.h b/znc.h index 82f91a28..c5bd934f 100644 --- a/znc.h +++ b/znc.h @@ -93,6 +93,7 @@ public: const CSockManager& GetManager() const { return m_Manager; } #ifdef _MODULES CGlobalModules& GetModules() { return *m_pModules; } + size_t FilterUncommonModules(set& ssModules); #endif const CString& GetStatusPrefix() const { return m_sStatusPrefix; } const CString& GetCurPath() const { if (!CFile::Exists(m_sCurPath)) { CDir::MakeDir(m_sCurPath); } return m_sCurPath; }