mirror of
https://github.com/znc/znc.git
synced 2026-05-08 22:34:45 +02:00
Add new module calls for writing config entries
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1803 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
@@ -63,6 +63,8 @@ bool CChan::WriteConfig(CFile& File) {
|
||||
if (!GetDefaultModes().empty())
|
||||
m_pUser->PrintLine(File, "\tModes", GetDefaultModes());
|
||||
|
||||
CZNC::Get().GetModules().OnWriteChanConfig(File, *this);
|
||||
|
||||
File.Write("\t</Chan>\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
+15
@@ -495,6 +495,9 @@ bool CModule::PutModNotice(const CString& sLine, const CString& sIdent, const CS
|
||||
// CGlobalModule //
|
||||
///////////////////
|
||||
CModule::EModRet CGlobalModule::OnConfigLine(const CString& sName, const CString& sValue, CUser* pUser, CChan* pChan) { return CONTINUE; }
|
||||
CModule::EModRet CGlobalModule::OnWriteConfig(CFile& Config) { return CONTINUE; }
|
||||
void CGlobalModule::OnWriteUserConfig(CFile& Config, CUser& User) {}
|
||||
void CGlobalModule::OnWriteChanConfig(CFile& Config, CChan& Chan) {}
|
||||
CModule::EModRet CGlobalModule::OnDeleteUser(CUser& User) { return CONTINUE; }
|
||||
void CGlobalModule::OnClientConnect(CClient* pClient, const CString& sHost, unsigned short uPort) {}
|
||||
CModule::EModRet CGlobalModule::OnLoginAttempt(CSmartPtr<CAuthBase> Auth) { return CONTINUE; }
|
||||
@@ -597,6 +600,18 @@ bool CGlobalModules::OnConfigLine(const CString& sName, const CString& sValue, C
|
||||
GLOBALMODHALTCHK(OnConfigLine(sName, sValue, pUser, pChan));
|
||||
}
|
||||
|
||||
bool CGlobalModules::OnWriteConfig(CFile& Config) {
|
||||
GLOBALMODHALTCHK(OnWriteConfig(Config));
|
||||
}
|
||||
|
||||
void CGlobalModules::OnWriteUserConfig(CFile& Config, CUser& User) {
|
||||
GLOBALMODCALL(OnWriteUserConfig(Config, User));
|
||||
}
|
||||
|
||||
void CGlobalModules::OnWriteChanConfig(CFile& Config, CChan& Chan) {
|
||||
GLOBALMODCALL(OnWriteChanConfig(Config, Chan));
|
||||
}
|
||||
|
||||
bool CGlobalModules::OnDeleteUser(CUser& User) {
|
||||
GLOBALMODHALTCHK(OnDeleteUser(User));
|
||||
}
|
||||
|
||||
@@ -862,9 +862,32 @@ public:
|
||||
* @param pChan If this line was found in a chan section, then this is
|
||||
* the corresponding CChan instance.
|
||||
* @return See CModule::EModRet.
|
||||
* @todo How are modules supposed to write these into the config?
|
||||
*/
|
||||
virtual EModRet OnConfigLine(const CString& sName, const CString& sValue, CUser* pUser, CChan* pChan);
|
||||
/** Called when ZNC starts rewriting the config file. This can be used
|
||||
* re-write the "GM:" lines for OnConfigLine() which would get lost
|
||||
* otherwise.
|
||||
* @param Config Reference to the CFile which will be used for writing
|
||||
* the config file.
|
||||
* @return See CModule::EModRet.
|
||||
*/
|
||||
virtual EModRet OnWriteConfig(CFile& Config);
|
||||
/** Called just before ZNC finishes a user section in the config file.
|
||||
* This can be used to re-write the "GM:" lines for OnConfigLine()
|
||||
* which would get lost otherwise.
|
||||
* @param Config Reference to the CFile which will be used for writing
|
||||
* the config file.
|
||||
* @param User The user which is being written.
|
||||
*/
|
||||
virtual void OnWriteUserConfig(CFile& Config, CUser& User);
|
||||
/** Called just before ZNC finishes a chan section in the config file.
|
||||
* This can be used to re-write the "GM:" lines for OnConfigLine()
|
||||
* which would get lost otherwise.
|
||||
* @param Config Reference to the CFile which will be used for writing
|
||||
* the config file.
|
||||
* @param Chan The channel which is being written.
|
||||
*/
|
||||
virtual void OnWriteChanConfig(CFile& Config, CChan& Chan);
|
||||
/** This module hook is called when a user is deleted.
|
||||
* @param User The user which will be deleted.
|
||||
* @return See CModule::EModRet.
|
||||
@@ -907,6 +930,9 @@ public:
|
||||
~CGlobalModules() {}
|
||||
|
||||
bool OnConfigLine(const CString& sName, const CString& sValue, CUser* pUser, CChan* pChan);
|
||||
bool OnWriteConfig(CFile& Config);
|
||||
void OnWriteUserConfig(CFile& Config, CUser& User);
|
||||
void OnWriteChanConfig(CFile& Config, CChan& Chan);
|
||||
bool OnDeleteUser(CUser& User);
|
||||
void OnClientConnect(CClient* pClient, const CString& sHost, unsigned short uPort);
|
||||
bool OnLoginAttempt(CSmartPtr<CAuthBase> Auth);
|
||||
|
||||
@@ -707,6 +707,8 @@ bool CUser::WriteConfig(CFile& File) {
|
||||
}
|
||||
}
|
||||
|
||||
CZNC::Get().GetModules().OnWriteUserConfig(File, *this);
|
||||
|
||||
File.Write("</User>\n");
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user