Update to the makeconf procedure... We now only ask for 9 common modules, instead of for all 20 or 30.

This will keep people from loading the sample or saslauth (or away) modules and thereby avoid stupid questions.

Instead of listing and asking for all modules, we only show the most widely used ones plus "And X other (uncommon) modules. You can enable those later.".

To add a module, append its name to the array in CZNC::FilterUncommonModules().


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1706 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
cflakes
2010-01-11 12:49:00 +00:00
parent c6b3e2507c
commit 68754d2781
2 changed files with 33 additions and 0 deletions
+32
View File
@@ -681,6 +681,7 @@ bool CZNC::WriteNewConfig(const CString& sConfigFile) {
#ifdef _MODULES
set<CModInfo> 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<CModInfo> 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<CModInfo>& ssModules) {
const char* ns[] = { "webadmin", "admin",
"chansaver", "keepnick", "simple_away", "partyline",
"kickrejoin", "nickserv", "perform" };
const set<CString> ssNames(ns, ns + sizeof(ns) / sizeof(ns[0]));
size_t uNrRemoved = 0;
for(set<CModInfo>::iterator it = ssModules.begin(); it != ssModules.end(); ) {
if(ssNames.count(it->GetName()) > 0) {
it++;
} else {
set<CModInfo>::iterator it2 = it++;
ssModules.erase(it2);
uNrRemoved++;
}
}
return uNrRemoved;
}
#endif
bool CZNC::ParseConfig(const CString& sConfig)
{
CString s;
+1
View File
@@ -93,6 +93,7 @@ public:
const CSockManager& GetManager() const { return m_Manager; }
#ifdef _MODULES
CGlobalModules& GetModules() { return *m_pModules; }
size_t FilterUncommonModules(set<CModInfo>& 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; }