From 962c10795d5a613dbc8edce517a26a340e74f0b5 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 30 Oct 2011 13:37:11 +0100 Subject: [PATCH 1/4] Disable some more warnings on mod{perl,python} It seems to me like swig is trying to trigger every warning that exists... Signed-off-by: Uli Schlachter --- modules/modperl/Makefile.inc | 1 + modules/modpython/Makefile.inc | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/modperl/Makefile.inc b/modules/modperl/Makefile.inc index e236370c..ae92d23f 100644 --- a/modules/modperl/Makefile.inc +++ b/modules/modperl/Makefile.inc @@ -6,6 +6,7 @@ PERL_CXX := $(shell $(PERL) -MExtUtils::Embed -e perl_inc) PERL_LD := $(shell $(PERL) -MExtUtils::Embed -e ldopts) # Perl API is ugly, casting string literals to char* and redeclaring functions :( PERL_CXX += -Wno-write-strings -Wno-redundant-decls -Wno-missing-declarations +PERL_CXX += -Wno-type-limits -Wno-sign-compare -Wno-strict-overflow # This is for SWIG PERL_CXX += -DSWIG_TYPE_TABLE=znc modperlCXXFLAGS := $(PERL_CXX) diff --git a/modules/modpython/Makefile.inc b/modules/modpython/Makefile.inc index 24eb9d30..fec0b084 100644 --- a/modules/modpython/Makefile.inc +++ b/modules/modpython/Makefile.inc @@ -3,8 +3,10 @@ ifeq "$(PYTHON_ON)" "yes" PYTHONCOMMON := $(PY_CFLAGS) PYTHONCOMMON += -DSWIG_TYPE_TABLE=znc +# Could someone fix all of these in swig / python, please? PYTHONCOMMON += -Wno-missing-field-initializers -Wno-unused -Wno-shadow -PYTHONCOMMON += -Wno-missing-declarations -Wno-uninitialized +PYTHONCOMMON += -Wno-missing-declarations -Wno-uninitialized -Wno-switch-enum +PYTHONCOMMON += -Wno-redundant-decls modpythonCXXFLAGS := $(PYTHONCOMMON) -I. modpythonLDFLAGS := $(PY_LDFLAGS) From a97abc53f78ec27645d07957363424cba945903c Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 30 Oct 2011 13:39:34 +0100 Subject: [PATCH 2/4] Just some small comment explaing some craziness Signed-off-by: Uli Schlachter --- include/znc/Buffer.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/znc/Buffer.h b/include/znc/Buffer.h index 8a1503b5..2613fab6 100644 --- a/include/znc/Buffer.h +++ b/include/znc/Buffer.h @@ -54,6 +54,7 @@ public: /// Same as AddLine, but replaces a line whose format string starts with sMatch if there is one. int UpdateLine(const CString& sMatch, const CString& sFormat, const CString& sText = ""); /// Same as UpdateLine, but does nothing if this exact line already exists. + /// We need this because "/version" sends us the 005 raws again int UpdateExactLine(const CString& sFormat, const CString& sText = ""); const CBufLine& GetBufLine(unsigned int uIdx) const; CString GetLine(unsigned int uIdx, const CClient& Client, const MCString& msParams = MCString::EmptyMap) const; From 9140a0dbd5dc2b73ccba256a9f12f653ed1c80cb Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 30 Oct 2011 13:42:36 +0100 Subject: [PATCH 3/4] CZNC::WriteConfig(): Better --debug output Signed-off-by: Uli Schlachter --- src/znc.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/znc.cpp b/src/znc.cpp index 20a188a3..949c5069 100644 --- a/src/znc.cpp +++ b/src/znc.cpp @@ -357,6 +357,7 @@ CString CZNC::ExpandConfigPath(const CString& sConfigFile, bool bAllowMkDir) { bool CZNC::WriteConfig() { if (GetConfigFile().empty()) { + DEBUG("Config file name is empty?!"); return false; } @@ -364,6 +365,7 @@ bool CZNC::WriteConfig() { CFile *pFile = new CFile(GetConfigFile() + "~"); if (!pFile->Open(O_WRONLY | O_CREAT | O_TRUNC, 0600)) { + DEBUG("Could not write config to " + GetConfigFile() + "~: " + CString(strerror(errno))); delete pFile; return false; } @@ -372,6 +374,7 @@ bool CZNC::WriteConfig() { // The old file (= inode) is going away and thus a lock on it would be // useless. These lock should always succeed (races, anyone?). if (!pFile->TryExLock()) { + DEBUG("Error while locking the new config file, errno says: " + CString(strerror(errno))); pFile->Delete(); delete pFile; return false; @@ -465,7 +468,7 @@ bool CZNC::WriteConfig() { // We wrote to a temporary name, move it to the right place if (!pFile->Move(GetConfigFile(), true)) { - DEBUG("Error while replacing the config file with a new version"); + DEBUG("Error while replacing the config file with a new version, errno says " << strerror(errno)); pFile->Delete(); delete pFile; return false; From a66721eacb74688740a38ce49630f91ce252420d Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 30 Oct 2011 13:44:36 +0100 Subject: [PATCH 4/4] webadmin: Add a "Disabled" checkbox for channels Signed-off-by: Uli Schlachter --- modules/webadmin.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/webadmin.cpp b/modules/webadmin.cpp index a7da9dd6..a4136cf0 100644 --- a/modules/webadmin.cpp +++ b/modules/webadmin.cpp @@ -560,6 +560,11 @@ public: o3["DisplayName"] = "Detached"; if (pChan && pChan->IsDetached()) { o3["Checked"] = "true"; } + CTemplate& o4 = Tmpl.AddRow("OptionLoop"); + o4["Name"] = "disabled"; + o4["DisplayName"] = "Disabled"; + if (pChan && pChan->IsDisabled()) { o4["Checked"] = "true"; } + FOR_EACH_MODULE(i, pUser) { CTemplate& mod = Tmpl.AddRow("EmbeddedModuleLoop"); mod.insert(Tmpl.begin(), Tmpl.end()); @@ -597,7 +602,6 @@ public: pChan->SetKey(WebSock.GetParam("key")); bool bDetached = WebSock.GetParam("detached").ToBool(); - if (pChan->IsDetached() != bDetached) { if (bDetached) { pChan->DetachUser(); @@ -606,6 +610,12 @@ public: } } + bool bDisabled = WebSock.GetParam("disabled").ToBool(); + if (bDisabled) + pChan->Disable(); + else + pChan->Enable(); + CTemplate TmplMod; TmplMod["User"] = pUser->GetUserName(); TmplMod["ChanName"] = sChanName;