From 4f1fd1f6db92e43dece355dcb3a0b6b7943122a6 Mon Sep 17 00:00:00 2001 From: Alexey Sokolov Date: Fri, 19 Oct 2012 22:14:14 +0700 Subject: [PATCH] Rename controlpanel to control, fix #240 It's just a shorter name, and hopefully still not as confusing as old "admin". Also unrelated change: fix case of few output lines during startup. --- modules/{controlpanel.cpp => control.cpp} | 11 +++++++++-- src/IRCNetwork.cpp | 4 ++-- src/User.cpp | 8 ++++---- src/znc.cpp | 14 +++++++------- 4 files changed, 22 insertions(+), 15 deletions(-) rename modules/{controlpanel.cpp => control.cpp} (99%) diff --git a/modules/controlpanel.cpp b/modules/control.cpp similarity index 99% rename from modules/controlpanel.cpp rename to modules/control.cpp index 682b80f9..cf6dae02 100644 --- a/modules/controlpanel.cpp +++ b/modules/control.cpp @@ -753,11 +753,18 @@ class CAdminMod : public CModule { return; } - if (!(pUser->FindNetwork(sNetwork))) { + CIRCNetwork* pNetwork = pUser->FindNetwork(sNetwork); + + if (!pNetwork) { PutModule(pUser->GetUserName() + " does not have a network named [" + sNetwork + "]"); return; } + if (pNetwork == m_pNetwork) { + PutModule("Currently active network can be deleted via *status"); + return; + } + if (pUser->DeleteNetwork(sNetwork)) { PutModule("Network deleted [" + sNetwork + "]"); } else { @@ -1126,7 +1133,7 @@ public: }; template<> void TModInfo(CModInfo& Info) { - Info.SetWikiPage("controlpanel"); + Info.SetWikiPage("control"); } USERMODULEDEFS(CAdminMod, "Dynamic configuration through IRC. Allows editing only yourself if you're not ZNC admin.") diff --git a/src/IRCNetwork.cpp b/src/IRCNetwork.cpp index d1e6b27a..11f398f9 100644 --- a/src/IRCNetwork.cpp +++ b/src/IRCNetwork.cpp @@ -313,7 +313,7 @@ bool CIRCNetwork::ParseConfig(CConfig *pConfig, CString& sError, bool bUpgrade) sModName = "awaystore"; } - CUtils::PrintAction("Loading Module [" + sModName + "]"); + CUtils::PrintAction("Loading network module [" + sModName + "]"); CString sModRet; CString sArgs = sValue.Token(1, true); @@ -329,7 +329,7 @@ bool CIRCNetwork::ParseConfig(CConfig *pConfig, CString& sError, bool bUpgrade) pConfig->FindStringVector("server", vsList); for (vit = vsList.begin(); vit != vsList.end(); ++vit) { - CUtils::PrintAction("Adding Server [" + *vit + "]"); + CUtils::PrintAction("Adding server [" + *vit + "]"); CUtils::PrintStatus(AddServer(*vit)); } diff --git a/src/User.cpp b/src/User.cpp index df9aa38d..7397783d 100644 --- a/src/User.cpp +++ b/src/User.cpp @@ -376,12 +376,12 @@ bool CUser::ParseConfig(CConfig* pConfig, CString& sError) { } // XXX Legacy crap, added in ZNC 0.207 - if (sModName == "admin") { - CUtils::PrintMessage("NOTICE: [admin] module was renamed, loading [controlpanel] instead"); - sModName = "controlpanel"; + if (sModName == "admin" || sModName == "controlpanel") { + CUtils::PrintMessage("NOTICE: [admin] module was renamed, loading [control] instead"); + sModName = "control"; } - CUtils::PrintAction("Loading Module [" + sModName + "]"); + CUtils::PrintAction("Loading user module [" + sModName + "]"); CString sModRet; CString sArgs = sValue.Token(1, true); bool bModRet = true; diff --git a/src/znc.cpp b/src/znc.cpp index 3e593387..97803a67 100644 --- a/src/znc.cpp +++ b/src/znc.cpp @@ -524,7 +524,7 @@ CString CZNC::MakeConfigHeader() { "// WARNING\n" "//\n" "// Do NOT edit this file while ZNC is running!\n" - "// Use webadmin or *controlpanel instead.\n" + "// Use webadmin or *control instead.\n" "//\n" "// Buf if you feel risky, you might want to read help on /znc saveconfig and /znc rehash.\n" "// Also check http://en.znc.in/wiki/Configuration\n"; @@ -956,7 +956,7 @@ bool CZNC::WriteNewConfig(const CString& sConfigFile) { } size_t CZNC::FilterUncommonModules(set& ssModules) { - const char* ns[] = { "webadmin", "controlpanel", + const char* ns[] = { "webadmin", "control", "chansaver", "keepnick", "simple_away", "partyline", "kickrejoin", "nickserv", "perform" }; const set ssNames(ns, ns + sizeof(ns) / sizeof(ns[0])); @@ -1030,7 +1030,7 @@ bool CZNC::DoRehash(CString& sError) { sError.clear(); - CUtils::PrintAction("Opening Config [" + m_sConfigFile + "]"); + CUtils::PrintAction("Opening config [" + m_sConfigFile + "]"); if (!CFile::Exists(m_sConfigFile)) { sError = "No such file"; @@ -1123,7 +1123,7 @@ bool CZNC::DoRehash(CString& sError) pOldMod = GetModules().FindModule(sModName); if (!pOldMod) { - CUtils::PrintAction("Loading Global Module [" + sModName + "]"); + CUtils::PrintAction("Loading global module [" + sModName + "]"); bool bModRet = GetModules().LoadModule(sModName, sArgs, CModInfo::GlobalModule, NULL, NULL, sModRet); @@ -1133,7 +1133,7 @@ bool CZNC::DoRehash(CString& sError) return false; } } else if (pOldMod->GetArgs() != sArgs) { - CUtils::PrintAction("Reloading Global Module [" + sModName + "]"); + CUtils::PrintAction("Reloading global module [" + sModName + "]"); bool bModRet = GetModules().ReloadModule(sModName, sArgs, NULL, NULL, sModRet); @@ -1154,7 +1154,7 @@ bool CZNC::DoRehash(CString& sError) if (!sISpoofFormat.empty() || !sISpoofFile.empty()) { CModule *pIdentFileMod = GetModules().FindModule("identfile"); if (!pIdentFileMod) { - CUtils::PrintAction("Loading Global Module [identfile]"); + CUtils::PrintAction("Loading global Module [identfile]"); CString sModRet; bool bModRet = GetModules().LoadModule("identfile", "", CModInfo::GlobalModule, NULL, NULL, sModRet); @@ -1330,7 +1330,7 @@ bool CZNC::DoRehash(CString& sError) for (set::iterator it = ssUnload.begin(); it != ssUnload.end(); ++it) { if (GetModules().UnloadModule(*it)) - CUtils::PrintMessage("Unloaded Global Module [" + *it + "]"); + CUtils::PrintMessage("Unloaded global module [" + *it + "]"); else CUtils::PrintMessage("Could not unload [" + *it + "]"); }