mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
Overhaul the config parsing
This moves stuff to a two-step model. First, the new class CConfig reads the config file, parses it and creates a in-memory model of stuff. Only then do we actually go forward and apply the stuff. The upside of this is that some config errors are caught before we change anything on the running upside. Let's see how much stuff this broke... Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
20
Chan.cpp
20
Chan.cpp
@@ -10,8 +10,9 @@
|
||||
#include "IRCSock.h"
|
||||
#include "User.h"
|
||||
#include "znc.h"
|
||||
#include "Config.h"
|
||||
|
||||
CChan::CChan(const CString& sName, CUser* pUser, bool bInConfig) {
|
||||
CChan::CChan(const CString& sName, CUser* pUser, bool bInConfig, CConfig *pConfig) {
|
||||
m_sName = sName.Token(0);
|
||||
m_sKey = sName.Token(1);
|
||||
m_pUser = pUser;
|
||||
@@ -27,6 +28,23 @@ CChan::CChan(const CString& sName, CUser* pUser, bool bInConfig) {
|
||||
m_bKeepBuffer = m_pUser->KeepBuffer();
|
||||
m_bDisabled = false;
|
||||
Reset();
|
||||
|
||||
if (pConfig) {
|
||||
CString sValue;
|
||||
if (pConfig->FindStringEntry("buffer", sValue))
|
||||
SetBufferCount(sValue.ToUInt(), true);
|
||||
if (pConfig->FindStringEntry("keepbuffer", sValue))
|
||||
SetKeepBuffer(sValue.ToBool());
|
||||
if (pConfig->FindStringEntry("detached", sValue))
|
||||
SetDetached(sValue.ToBool());
|
||||
if (pConfig->FindStringEntry("autocycle", sValue))
|
||||
if (sValue.Equals("true"))
|
||||
CUtils::PrintError("WARNING: AutoCycle has been removed, instead try -> LoadModule = autocycle " + sName);
|
||||
if (pConfig->FindStringEntry("key", sValue))
|
||||
SetKey(sValue);
|
||||
if (pConfig->FindStringEntry("modes", sValue))
|
||||
SetDefaultModes(sValue);
|
||||
}
|
||||
}
|
||||
|
||||
CChan::~CChan() {
|
||||
|
||||
Reference in New Issue
Block a user