mirror of
https://github.com/znc/znc.git
synced 2026-08-08 18:03:22 +02:00
Add a config writer
This commit is contained in:
@@ -64,26 +64,21 @@ void CChan::Reset() {
|
||||
ResetJoinTries();
|
||||
}
|
||||
|
||||
bool CChan::WriteConfig(CFile& File) {
|
||||
if (!InConfig()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
File.Write("\t<Chan " + GetName().FirstLine() + ">\n");
|
||||
CConfig CChan::ToConfig() {
|
||||
CConfig config;
|
||||
|
||||
if (m_pUser->GetBufferCount() != GetBufferCount())
|
||||
m_pUser->PrintLine(File, "\tBuffer", CString(GetBufferCount()));
|
||||
config.AddKeyValuePair("Buffer", CString(GetBufferCount()));
|
||||
if (m_pUser->KeepBuffer() != KeepBuffer())
|
||||
m_pUser->PrintLine(File, "\tKeepBuffer", CString(KeepBuffer()));
|
||||
config.AddKeyValuePair("KeepBuffer", CString(KeepBuffer()));
|
||||
if (IsDetached())
|
||||
m_pUser->PrintLine(File, "\tDetached", "true");
|
||||
config.AddKeyValuePair("Detached", "true");
|
||||
if (!GetKey().empty())
|
||||
m_pUser->PrintLine(File, "\tKey", GetKey());
|
||||
config.AddKeyValuePair("Key", GetKey());
|
||||
if (!GetDefaultModes().empty())
|
||||
m_pUser->PrintLine(File, "\tModes", GetDefaultModes());
|
||||
config.AddKeyValuePair("Modes", GetDefaultModes());
|
||||
|
||||
File.Write("\t</Chan>\n");
|
||||
return true;
|
||||
return config;
|
||||
}
|
||||
|
||||
void CChan::Clone(CChan& chan) {
|
||||
|
||||
Reference in New Issue
Block a user