mirror of
https://github.com/znc/znc.git
synced 2026-08-08 09:52:55 +02:00
Merge commit 'refs/pull/705/head' of github.com:znc/znc
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#include <znc/User.h>
|
||||
#include <znc/IRCNetwork.h>
|
||||
#include <znc/Config.h>
|
||||
#include <znc/znc.h>
|
||||
|
||||
using std::set;
|
||||
using std::vector;
|
||||
@@ -364,6 +365,13 @@ void CChan::ModeChange(const CString& sModes, const CNick* pOpNick) {
|
||||
if (!bList) {
|
||||
(bAdd) ? AddMode(uMode, sArg) : RemMode(uMode);
|
||||
}
|
||||
|
||||
// This is called when we join (ZNC requests the channel modes
|
||||
// on join) *and* when someone changes the channel keys.
|
||||
// We ignore channel key "*" because of some broken nets.
|
||||
if (uMode == 'k' && !bNoChange && bAdd && sArg != "*") {
|
||||
SetKey(sArg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -623,3 +631,21 @@ void CChan::Enable() {
|
||||
ResetJoinTries();
|
||||
m_bDisabled = false;
|
||||
}
|
||||
|
||||
void CChan::SetKey(const CString& s) {
|
||||
if (m_sKey != s) {
|
||||
m_sKey = s;
|
||||
if (m_bInConfig) {
|
||||
CZNC::Get().SetConfigState(CZNC::ECONFIG_NEED_WRITE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CChan::SetInConfig(bool b) {
|
||||
if (m_bInConfig != b) {
|
||||
m_bInConfig = b;
|
||||
if (m_bInConfig) {
|
||||
CZNC::Get().SetConfigState(CZNC::ECONFIG_NEED_WRITE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -146,7 +146,7 @@ static void signalHandler(int sig) {
|
||||
break;
|
||||
case SIGUSR1:
|
||||
CUtils::PrintMessage("Caught SIGUSR1");
|
||||
CZNC::Get().SetConfigState(CZNC::ECONFIG_NEED_WRITE);
|
||||
CZNC::Get().SetConfigState(CZNC::ECONFIG_NEED_VERBOSE_WRITE);
|
||||
break;
|
||||
default:
|
||||
CUtils::PrintMessage("WTF? Signal handler called for a signal it doesn't know?");
|
||||
|
||||
+6
-4
@@ -178,7 +178,8 @@ void CZNC::Loop() {
|
||||
while (true) {
|
||||
CString sError;
|
||||
|
||||
switch (GetConfigState()) {
|
||||
ConfigState eState = GetConfigState();
|
||||
switch (eState) {
|
||||
case ECONFIG_NEED_REHASH:
|
||||
SetConfigState(ECONFIG_NOTHING);
|
||||
|
||||
@@ -190,12 +191,13 @@ void CZNC::Loop() {
|
||||
}
|
||||
break;
|
||||
case ECONFIG_NEED_WRITE:
|
||||
case ECONFIG_NEED_VERBOSE_WRITE:
|
||||
SetConfigState(ECONFIG_NOTHING);
|
||||
|
||||
if (WriteConfig()) {
|
||||
Broadcast("Writing the config succeeded", true);
|
||||
} else {
|
||||
if (!WriteConfig()) {
|
||||
Broadcast("Writing the config file failed", true);
|
||||
} else if (eState == ECONFIG_NEED_VERBOSE_WRITE) {
|
||||
Broadcast("Writing the config succeeded", true);
|
||||
}
|
||||
break;
|
||||
case ECONFIG_NOTHING:
|
||||
|
||||
Reference in New Issue
Block a user