Remove config-related module hooks

This removes the following module hooks:

OnConfigLine()
OnWriteConfig()
OnWriteUserConfig()
OnWriteChanConfig()

Modules could use these hooks for writing/reading their own stuff to/from
znc.conf. However, no module (ever?) did this and IMHO no module should ever do
this either. Modules can save stuff via SetNV(), module arguments (SetArgs())
and in their GetSavePath().

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter
2011-03-31 17:29:49 +02:00
parent 45209eca33
commit 23fb4df67a
11 changed files with 0 additions and 113 deletions
-41
View File
@@ -14,17 +14,6 @@
#include "Listener.h"
#include <list>
namespace
{ // private namespace for local things
struct CGlobalModuleConfigLine
{
CString m_sName;
CString m_sValue;
CUser *m_pUser;
CChan *m_pChan;
};
}
static inline CString FormatBindError() {
CString sError = (errno == 0 ? CString("unknown error, check the host name") : CString(strerror(errno)));
return "Unable to bind [" + sError + "]";
@@ -435,8 +424,6 @@ bool CZNC::WriteConfig() {
m_LockFile.Write(MakeConfigHeader() + "\n");
GLOBALMODULECALL(OnWriteConfig(m_LockFile), NULL, NULL, return false);
m_LockFile.Write("AnonIPLimit = " + CString(m_uiAnonIPLimit) + "\n");
m_LockFile.Write("MaxBufferSize= " + CString(m_uiMaxBufferSize) + "\n");
m_LockFile.Write("SSLCertFile = " + CString(m_sSSLCertFile) + "\n");
@@ -1014,8 +1001,6 @@ bool CZNC::DoRehash(CString& sError)
unsigned int uLineNum = 0;
MCString msModules; // Modules are queued for later loading
std::list<CGlobalModuleConfigLine> lGlobalModuleConfigLine;
while (File.ReadLine(sLine)) {
uLineNum++;
@@ -1605,16 +1590,6 @@ bool CZNC::DoRehash(CString& sError)
}
if (sName.Equals("GM:", false, 3))
{ // GM: prefix is a pass through to config lines for global modules
CGlobalModuleConfigLine cTmp;
cTmp.m_sName = sName.substr(3, CString::npos);
cTmp.m_sValue = sValue;
cTmp.m_pChan = pChan;
cTmp.m_pUser = pUser;
lGlobalModuleConfigLine.push_back(cTmp);
}
else
{
sError = "Unhandled line " + CString(uLineNum) + " in config: [" + sLine + "]";
CUtils::PrintError(sError);
@@ -1638,22 +1613,6 @@ bool CZNC::DoRehash(CString& sError)
CUtils::PrintMessage("Could not unload [" + *it + "]");
}
// last step, throw unhandled config items at global config
for (std::list<CGlobalModuleConfigLine>::iterator it = lGlobalModuleConfigLine.begin(); it != lGlobalModuleConfigLine.end(); ++it)
{
if ((pChan && pChan == it->m_pChan) || (pUser && pUser == it->m_pUser))
continue; // skip unclosed user or chan
bool bHandled = false;
if (it->m_pUser) {
MODULECALL(OnConfigLine(it->m_sName, it->m_sValue, it->m_pUser, it->m_pChan), it->m_pUser, NULL, bHandled = true);
} else {
GLOBALMODULECALL(OnConfigLine(it->m_sName, it->m_sValue, it->m_pUser, it->m_pChan), it->m_pUser, NULL, bHandled = true);
}
if (!bHandled) {
CUtils::PrintMessage("unhandled global module config line [GM:" + it->m_sName + "] = [" + it->m_sValue + "]");
}
}
if (pChan) {
sError = "Last <Chan> section not properly closed. File truncated?";
CUtils::PrintError(sError);