Permalink
Browse files

Merge branch 'master' of github.com:znc/znc

  • Loading branch information...
Alexey Sokolov
Alexey Sokolov committed Nov 3, 2011
2 parents 7ac4609 + a66721e commit 73b980bb834d728676f2ea4aad3c81f9f80c72a2
Showing with 20 additions and 3 deletions.
  1. +1 −0 include/znc/Buffer.h
  2. +1 −0 modules/modperl/Makefile.inc
  3. +3 −1 modules/modpython/Makefile.inc
  4. +11 −1 modules/webadmin.cpp
  5. +4 −1 src/znc.cpp
View
@@ -54,6 +54,7 @@ class CBuffer : private deque<CBufLine> {
/// 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;
@@ -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)
@@ -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)
View
@@ -560,6 +560,11 @@ class CWebAdminMod : public CModule {
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 @@ class CWebAdminMod : public CModule {
pChan->SetKey(WebSock.GetParam("key"));
bool bDetached = WebSock.GetParam("detached").ToBool();
-
if (pChan->IsDetached() != bDetached) {
if (bDetached) {
pChan->DetachUser();
@@ -606,6 +610,12 @@ class CWebAdminMod : public CModule {
}
}
+ bool bDisabled = WebSock.GetParam("disabled").ToBool();
+ if (bDisabled)
+ pChan->Disable();
+ else
+ pChan->Enable();
+
CTemplate TmplMod;
TmplMod["User"] = pUser->GetUserName();
TmplMod["ChanName"] = sChanName;
View
@@ -357,13 +357,15 @@ CString CZNC::ExpandConfigPath(const CString& sConfigFile, bool bAllowMkDir) {
bool CZNC::WriteConfig() {
if (GetConfigFile().empty()) {
+ DEBUG("Config file name is empty?!");
return false;
}
// We first write to a temporary file and then move it to the right place
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;

0 comments on commit 73b980b

Please sign in to comment.