mirror of
https://github.com/znc/znc.git
synced 2026-07-04 08:51:14 +02:00
Use nullptr (#816)
Changes applied by 'clang-modernize -use-nullptr [...]'
This commit is contained in:
@@ -29,7 +29,7 @@ class CClient;
|
||||
class CBufLine {
|
||||
public:
|
||||
CBufLine() { throw 0; } // shouldn't be called, but is needed for compilation
|
||||
CBufLine(const CString& sFormat, const CString& sText = "", const timeval* ts = 0);
|
||||
CBufLine(const CString& sFormat, const CString& sText = "", const timeval* ts = nullptr);
|
||||
~CBufLine();
|
||||
CString GetLine(const CClient& Client, const MCString& msParams) const;
|
||||
void UpdateTime();
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
CBuffer(unsigned int uLineCount = 100);
|
||||
~CBuffer();
|
||||
|
||||
size_type AddLine(const CString& sFormat, const CString& sText = "", const timeval* ts = 0);
|
||||
size_type AddLine(const CString& sFormat, const CString& sText = "", const timeval* ts = nullptr);
|
||||
/// Same as AddLine, but replaces a line whose format string starts with sMatch if there is one.
|
||||
size_type UpdateLine(const CString& sMatch, const CString& sFormat, const CString& sText = "");
|
||||
/// Same as UpdateLine, but does nothing if this exact line already exists.
|
||||
|
||||
+4
-4
@@ -56,7 +56,7 @@ public:
|
||||
M_Except = 'e'
|
||||
} EModes;
|
||||
|
||||
CChan(const CString& sName, CIRCNetwork* pNetwork, bool bInConfig, CConfig *pConfig = NULL);
|
||||
CChan(const CString& sName, CIRCNetwork* pNetwork, bool bInConfig, CConfig *pConfig = nullptr);
|
||||
~CChan();
|
||||
|
||||
CChan(const CChan&) = delete;
|
||||
@@ -67,14 +67,14 @@ public:
|
||||
void Clone(CChan& chan);
|
||||
void Cycle() const;
|
||||
void JoinUser(const CString& sKey = "");
|
||||
void AttachUser(CClient* pClient = NULL);
|
||||
void AttachUser(CClient* pClient = nullptr);
|
||||
void DetachUser();
|
||||
|
||||
void OnWho(const CString& sNick, const CString& sIdent, const CString& sHost);
|
||||
|
||||
// Modes
|
||||
void SetModes(const CString& s);
|
||||
void ModeChange(const CString& sModes, const CNick* OpNick = NULL);
|
||||
void ModeChange(const CString& sModes, const CNick* OpNick = nullptr);
|
||||
bool AddMode(unsigned char uMode, const CString& sArg);
|
||||
bool RemMode(unsigned char uMode);
|
||||
CString GetModeString() const;
|
||||
@@ -97,7 +97,7 @@ public:
|
||||
unsigned int GetBufferCount() const { return m_Buffer.GetLineCount(); }
|
||||
bool SetBufferCount(unsigned int u, bool bForce = false) { m_bHasBufferCountSet = true; return m_Buffer.SetLineCount(u, bForce); }
|
||||
void InheritBufferCount(unsigned int u, bool bForce = false) { if (!m_bHasBufferCountSet) m_Buffer.SetLineCount(u, bForce); }
|
||||
size_t AddBuffer(const CString& sFormat, const CString& sText = "", const timeval* ts = NULL) { return m_Buffer.AddLine(sFormat, sText, ts); }
|
||||
size_t AddBuffer(const CString& sFormat, const CString& sText = "", const timeval* ts = nullptr) { return m_Buffer.AddLine(sFormat, sText, ts); }
|
||||
void ClearBuffer() { m_Buffer.Clear(); }
|
||||
void SendBuffer(CClient* pClient);
|
||||
void SendBuffer(CClient* pClient, const CBuffer& Buffer);
|
||||
|
||||
@@ -80,7 +80,7 @@ public:
|
||||
CClientAuth(const CClientAuth&) = delete;
|
||||
CClientAuth& operator=(const CClientAuth&) = delete;
|
||||
|
||||
void Invalidate() { m_pClient = NULL; CAuthBase::Invalidate(); }
|
||||
void Invalidate() { m_pClient = nullptr; CAuthBase::Invalidate(); }
|
||||
void AcceptedLogin(CUser& User);
|
||||
void RefusedLogin(const CString& sReason);
|
||||
private:
|
||||
@@ -91,8 +91,8 @@ protected:
|
||||
class CClient : public CIRCSocket {
|
||||
public:
|
||||
CClient() : CIRCSocket() {
|
||||
m_pUser = NULL;
|
||||
m_pNetwork = NULL;
|
||||
m_pUser = nullptr;
|
||||
m_pNetwork = nullptr;
|
||||
m_bGotPass = false;
|
||||
m_bGotNick = false;
|
||||
m_bGotUser = false;
|
||||
@@ -137,7 +137,7 @@ public:
|
||||
void UserPortCommand(CString& sLine);
|
||||
void StatusCTCP(const CString& sCommand);
|
||||
void BouncedOff();
|
||||
bool IsAttached() const { return m_pUser != NULL; }
|
||||
bool IsAttached() const { return m_pUser != nullptr; }
|
||||
|
||||
bool IsPlaybackActive() const { return m_bPlaybackActive; }
|
||||
void SetPlaybackActive(bool bActive) { m_bPlaybackActive = bActive; }
|
||||
|
||||
@@ -188,7 +188,7 @@ public:
|
||||
|
||||
struct dirent * de;
|
||||
|
||||
while ((de = readdir(dir)) != 0) {
|
||||
while ((de = readdir(dir)) != nullptr) {
|
||||
if ((strcmp(de->d_name, ".") == 0) || (strcmp(de->d_name, "..") == 0)) {
|
||||
continue;
|
||||
}
|
||||
@@ -249,7 +249,7 @@ public:
|
||||
|
||||
static CString GetCWD() {
|
||||
CString sRet;
|
||||
char * pszCurDir = getcwd(NULL, 0);
|
||||
char * pszCurDir = getcwd(nullptr, 0);
|
||||
if (pszCurDir) {
|
||||
sRet = pszCurDir;
|
||||
free(pszCurDir);
|
||||
|
||||
@@ -89,9 +89,9 @@ public:
|
||||
const CModules& GetModules() const { return *m_pModules; }
|
||||
// !Modules
|
||||
|
||||
bool PutUser(const CString& sLine, CClient* pClient = NULL, CClient* pSkipClient = NULL);
|
||||
bool PutStatus(const CString& sLine, CClient* pClient = NULL, CClient* pSkipClient = NULL);
|
||||
bool PutModule(const CString& sModule, const CString& sLine, CClient* pClient = NULL, CClient* pSkipClient = NULL);
|
||||
bool PutUser(const CString& sLine, CClient* pClient = nullptr, CClient* pSkipClient = nullptr);
|
||||
bool PutStatus(const CString& sLine, CClient* pClient = nullptr, CClient* pSkipClient = nullptr);
|
||||
bool PutModule(const CString& sModule, const CString& sLine, CClient* pClient = nullptr, CClient* pSkipClient = nullptr);
|
||||
|
||||
const std::vector<CChan*>& GetChans() const;
|
||||
CChan* FindChan(CString sName) const;
|
||||
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
m_bSSL = bSSL;
|
||||
m_eAddr = eAddr;
|
||||
m_sURIPrefix = sURIPrefix;
|
||||
m_pListener = NULL;
|
||||
m_pListener = nullptr;
|
||||
m_eAcceptType = eAccept;
|
||||
}
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ class CFPTimer : public CTimer {
|
||||
public:
|
||||
CFPTimer(CModule* pModule, unsigned int uInterval, unsigned int uCycles, const CString& sLabel, const CString& sDescription)
|
||||
: CTimer(pModule, uInterval, uCycles, sLabel, sDescription) {
|
||||
m_pFBCallback = NULL;
|
||||
m_pFBCallback = nullptr;
|
||||
}
|
||||
|
||||
virtual ~CFPTimer() {}
|
||||
@@ -221,13 +221,13 @@ public:
|
||||
} EModuleType;
|
||||
|
||||
CModInfo() {
|
||||
m_fLoader = NULL;
|
||||
m_fLoader = nullptr;
|
||||
m_bHasArgs = false;
|
||||
}
|
||||
CModInfo(const CString& sName, const CString& sPath, EModuleType eType) {
|
||||
m_sName = sName;
|
||||
m_sPath = sPath;
|
||||
m_fLoader = NULL;
|
||||
m_fLoader = nullptr;
|
||||
m_bHasArgs = false;
|
||||
}
|
||||
~CModInfo() {}
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ public:
|
||||
const CBuffer& GetBuffer() const { return m_Buffer; }
|
||||
unsigned int GetBufferCount() const { return m_Buffer.GetLineCount(); }
|
||||
bool SetBufferCount(unsigned int u, bool bForce = false) { return m_Buffer.SetLineCount(u, bForce); }
|
||||
size_t AddBuffer(const CString& sFormat, const CString& sText = "", const timeval* ts = NULL) { return m_Buffer.AddLine(sFormat, sText, ts); }
|
||||
size_t AddBuffer(const CString& sFormat, const CString& sText = "", const timeval* ts = nullptr) { return m_Buffer.AddLine(sFormat, sText, ts); }
|
||||
void ClearBuffer() { m_Buffer.Clear(); }
|
||||
void SendBuffer(CClient* pClient);
|
||||
void SendBuffer(CClient* pClient, const CBuffer& Buffer);
|
||||
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
CSockManager();
|
||||
virtual ~CSockManager();
|
||||
|
||||
bool ListenHost(u_short iPort, const CString& sSockName, const CString& sBindHost, bool bSSL = false, int iMaxConns = SOMAXCONN, CZNCSock *pcSock = NULL, u_int iTimeout = 0, EAddrType eAddr = ADDR_ALL) {
|
||||
bool ListenHost(u_short iPort, const CString& sSockName, const CString& sBindHost, bool bSSL = false, int iMaxConns = SOMAXCONN, CZNCSock *pcSock = nullptr, u_int iTimeout = 0, EAddrType eAddr = ADDR_ALL) {
|
||||
CSListener L(iPort, sBindHost);
|
||||
|
||||
L.SetSockName(sSockName);
|
||||
@@ -92,11 +92,11 @@ public:
|
||||
return Listen(L, pcSock);
|
||||
}
|
||||
|
||||
bool ListenAll(u_short iPort, const CString& sSockName, bool bSSL = false, int iMaxConns = SOMAXCONN, CZNCSock *pcSock = NULL, u_int iTimeout = 0, EAddrType eAddr = ADDR_ALL) {
|
||||
bool ListenAll(u_short iPort, const CString& sSockName, bool bSSL = false, int iMaxConns = SOMAXCONN, CZNCSock *pcSock = nullptr, u_int iTimeout = 0, EAddrType eAddr = ADDR_ALL) {
|
||||
return ListenHost(iPort, sSockName, "", bSSL, iMaxConns, pcSock, iTimeout, eAddr);
|
||||
}
|
||||
|
||||
u_short ListenRand(const CString& sSockName, const CString& sBindHost, bool bSSL = false, int iMaxConns = SOMAXCONN, CZNCSock *pcSock = NULL, u_int iTimeout = 0, EAddrType eAddr = ADDR_ALL) {
|
||||
u_short ListenRand(const CString& sSockName, const CString& sBindHost, bool bSSL = false, int iMaxConns = SOMAXCONN, CZNCSock *pcSock = nullptr, u_int iTimeout = 0, EAddrType eAddr = ADDR_ALL) {
|
||||
unsigned short uPort = 0;
|
||||
CSListener L(0, sBindHost);
|
||||
|
||||
@@ -124,11 +124,11 @@ public:
|
||||
return uPort;
|
||||
}
|
||||
|
||||
u_short ListenAllRand(const CString& sSockName, bool bSSL = false, int iMaxConns = SOMAXCONN, CZNCSock *pcSock = NULL, u_int iTimeout = 0, EAddrType eAddr = ADDR_ALL) {
|
||||
u_short ListenAllRand(const CString& sSockName, bool bSSL = false, int iMaxConns = SOMAXCONN, CZNCSock *pcSock = nullptr, u_int iTimeout = 0, EAddrType eAddr = ADDR_ALL) {
|
||||
return(ListenRand(sSockName, "", bSSL, iMaxConns, pcSock, iTimeout, eAddr));
|
||||
}
|
||||
|
||||
void Connect(const CString& sHostname, u_short iPort, const CString& sSockName, int iTimeout = 60, bool bSSL = false, const CString& sBindHost = "", CZNCSock *pcSock = NULL);
|
||||
void Connect(const CString& sHostname, u_short iPort, const CString& sSockName, int iTimeout = 60, bool bSSL = false, const CString& sBindHost = "", CZNCSock *pcSock = nullptr);
|
||||
|
||||
unsigned int GetAnonConnectionCount(const CString &sIP) const;
|
||||
private:
|
||||
|
||||
@@ -128,7 +128,7 @@ public:
|
||||
Init();
|
||||
}
|
||||
|
||||
CTemplate(const std::shared_ptr<CTemplateOptions>& Options, CTemplate* pParent = NULL) : MCString(), m_spOptions(Options) {
|
||||
CTemplate(const std::shared_ptr<CTemplateOptions>& Options, CTemplate* pParent = nullptr) : MCString(), m_spOptions(Options) {
|
||||
Init();
|
||||
m_pParent = pParent;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
friend class CConditionVariable;
|
||||
|
||||
CMutex() {
|
||||
int i = pthread_mutex_init(&m_mutex, NULL);
|
||||
int i = pthread_mutex_init(&m_mutex, nullptr);
|
||||
if (i) {
|
||||
CUtils::PrintError("Can't initialize mutex: " + CString(strerror(errno)));
|
||||
exit(1);
|
||||
@@ -124,7 +124,7 @@ private:
|
||||
class CConditionVariable {
|
||||
public:
|
||||
CConditionVariable() {
|
||||
int i = pthread_cond_init(&m_cond, NULL);
|
||||
int i = pthread_cond_init(&m_cond, nullptr);
|
||||
if (i) {
|
||||
CUtils::PrintError("Can't initialize condition variable: "
|
||||
+ CString(strerror(errno)));
|
||||
@@ -188,8 +188,8 @@ public:
|
||||
*/
|
||||
int i = sigfillset(&sigmask);
|
||||
i |= pthread_sigmask(SIG_SETMASK, &sigmask, &old_sigmask);
|
||||
i |= pthread_create(&thr, NULL, func, arg);
|
||||
i |= pthread_sigmask(SIG_SETMASK, &old_sigmask, NULL);
|
||||
i |= pthread_create(&thr, nullptr, func, arg);
|
||||
i |= pthread_sigmask(SIG_SETMASK, &old_sigmask, nullptr);
|
||||
i |= pthread_detach(thr);
|
||||
if (i) {
|
||||
CUtils::PrintError("Can't start new thread: "
|
||||
@@ -295,7 +295,7 @@ private:
|
||||
static void *threadPoolFunc(void *arg) {
|
||||
CThreadPool &pool = *reinterpret_cast<CThreadPool *>(arg);
|
||||
pool.threadFunc();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// mutex protecting all of these members
|
||||
|
||||
+6
-6
@@ -83,12 +83,12 @@ public:
|
||||
bool HasSpaceForNewNetwork() const;
|
||||
// !Networks
|
||||
|
||||
bool PutUser(const CString& sLine, CClient* pClient = NULL, CClient* pSkipClient = NULL);
|
||||
bool PutAllUser(const CString& sLine, CClient* pClient = NULL, CClient* pSkipClient = NULL);
|
||||
bool PutStatus(const CString& sLine, CClient* pClient = NULL, CClient* pSkipClient = NULL);
|
||||
bool PutStatusNotice(const CString& sLine, CClient* pClient = NULL, CClient* pSkipClient = NULL);
|
||||
bool PutModule(const CString& sModule, const CString& sLine, CClient* pClient = NULL, CClient* pSkipClient = NULL);
|
||||
bool PutModNotice(const CString& sModule, const CString& sLine, CClient* pClient = NULL, CClient* pSkipClient = NULL);
|
||||
bool PutUser(const CString& sLine, CClient* pClient = nullptr, CClient* pSkipClient = nullptr);
|
||||
bool PutAllUser(const CString& sLine, CClient* pClient = nullptr, CClient* pSkipClient = nullptr);
|
||||
bool PutStatus(const CString& sLine, CClient* pClient = nullptr, CClient* pSkipClient = nullptr);
|
||||
bool PutStatusNotice(const CString& sLine, CClient* pClient = nullptr, CClient* pSkipClient = nullptr);
|
||||
bool PutModule(const CString& sModule, const CString& sLine, CClient* pClient = nullptr, CClient* pSkipClient = nullptr);
|
||||
bool PutModNotice(const CString& sModule, const CString& sLine, CClient* pClient = nullptr, CClient* pSkipClient = nullptr);
|
||||
|
||||
bool IsUserAttached() const;
|
||||
void UserConnected(CClient* pClient);
|
||||
|
||||
+3
-3
@@ -65,13 +65,13 @@ public:
|
||||
static CString GetPass(const CString& sPrompt);
|
||||
static bool GetInput(const CString& sPrompt, CString& sRet, const CString& sDefault = "", const CString& sHint = "");
|
||||
static bool GetBoolInput(const CString& sPrompt, bool bDefault);
|
||||
static bool GetBoolInput(const CString& sPrompt, bool *pbDefault = NULL);
|
||||
static bool GetBoolInput(const CString& sPrompt, bool *pbDefault = nullptr);
|
||||
static bool GetNumInput(const CString& sPrompt, unsigned int& uRet, unsigned int uMin = 0, unsigned int uMax = ~0, unsigned int uDefault = ~0);
|
||||
|
||||
static unsigned long long GetMillTime() {
|
||||
struct timeval tv;
|
||||
unsigned long long iTime = 0;
|
||||
gettimeofday(&tv, NULL);
|
||||
gettimeofday(&tv, nullptr);
|
||||
iTime = (unsigned long long) tv.tv_sec * 1000;
|
||||
iTime += ((unsigned long long) tv.tv_usec / 1000);
|
||||
return iTime;
|
||||
@@ -318,7 +318,7 @@ public:
|
||||
Cleanup();
|
||||
iterator it = m_mItems.find(Item);
|
||||
if (it == m_mItems.end())
|
||||
return NULL;
|
||||
return nullptr;
|
||||
return &it->second.second;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
const CString& GetIP() const { return m_sIP; }
|
||||
CUser* GetUser() const { return m_pUser; }
|
||||
time_t GetLastActive() const { return m_tmLastActive; }
|
||||
bool IsLoggedIn() const { return m_pUser != NULL; }
|
||||
bool IsLoggedIn() const { return m_pUser != nullptr; }
|
||||
bool IsAdmin() const;
|
||||
void UpdateLastActive();
|
||||
|
||||
@@ -128,8 +128,8 @@ public:
|
||||
bool OnLogin(const CString& sUser, const CString& sPass, bool bBasic) override;
|
||||
void OnPageRequest(const CString& sURI) override;
|
||||
|
||||
EPageReqResult PrintTemplate(const CString& sPageName, CString& sPageRet, CModule* pModule = NULL);
|
||||
EPageReqResult PrintStaticFile(const CString& sPath, CString& sPageRet, CModule* pModule = NULL);
|
||||
EPageReqResult PrintTemplate(const CString& sPageName, CString& sPageRet, CModule* pModule = nullptr);
|
||||
EPageReqResult PrintStaticFile(const CString& sPath, CString& sPageRet, CModule* pModule = nullptr);
|
||||
|
||||
CString FindTmpl(CModule* pModule, const CString& sName);
|
||||
|
||||
@@ -150,7 +150,7 @@ public:
|
||||
protected:
|
||||
using CHTTPSock::PrintErrorPage;
|
||||
|
||||
bool AddModLoop(const CString& sLoopName, CModule& Module, CTemplate *pTemplate = NULL);
|
||||
bool AddModLoop(const CString& sLoopName, CModule& Module, CTemplate *pTemplate = nullptr);
|
||||
VCString GetDirs(CModule* pModule, bool bIsTemplate);
|
||||
void SetPaths(CModule* pModule, bool bIsTemplate = false);
|
||||
void SetVars();
|
||||
|
||||
@@ -564,7 +564,7 @@ public:
|
||||
|
||||
private:
|
||||
protected:
|
||||
unsigned char* strnchr(const unsigned char* src, unsigned char c, unsigned int iMaxBytes, unsigned char* pFill = NULL, unsigned int* piCount = NULL) const;
|
||||
unsigned char* strnchr(const unsigned char* src, unsigned char c, unsigned int iMaxBytes, unsigned char* pFill = nullptr, unsigned int* piCount = nullptr) const;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ public:
|
||||
bool AddTrustedProxy(const CString& sHost);
|
||||
bool RemTrustedProxy(const CString& sHost);
|
||||
void Broadcast(const CString& sMessage, bool bAdminOnly = false,
|
||||
CUser* pSkipUser = NULL, CClient* pSkipClient = NULL);
|
||||
CUser* pSkipUser = nullptr, CClient* pSkipClient = nullptr);
|
||||
void AddBytesRead(unsigned long long u) { m_uBytesRead += u; }
|
||||
void AddBytesWritten(unsigned long long u) { m_uBytesWritten += u; }
|
||||
unsigned long long BytesRead() const { return m_uBytesRead; }
|
||||
|
||||
+3
-3
@@ -20,7 +20,7 @@
|
||||
CBufLine::CBufLine(const CString& sFormat, const CString& sText, const timeval* ts) {
|
||||
m_sFormat = sFormat;
|
||||
m_sText = sText;
|
||||
if (ts == NULL)
|
||||
if (ts == nullptr)
|
||||
UpdateTime();
|
||||
else
|
||||
m_time = *ts;
|
||||
@@ -29,10 +29,10 @@ CBufLine::CBufLine(const CString& sFormat, const CString& sText, const timeval*
|
||||
CBufLine::~CBufLine() {}
|
||||
|
||||
void CBufLine::UpdateTime() {
|
||||
if (0 == gettimeofday(&m_time, NULL)) {
|
||||
if (0 == gettimeofday(&m_time, nullptr)) {
|
||||
return;
|
||||
}
|
||||
m_time.tv_sec = time(NULL);
|
||||
m_time.tv_sec = time(nullptr);
|
||||
m_time.tv_usec = 0;
|
||||
}
|
||||
|
||||
|
||||
+12
-12
@@ -293,7 +293,7 @@ void CChan::ModeChange(const CString& sModes, const CNick* pOpNick) {
|
||||
pOpNick = OpNick;
|
||||
}
|
||||
|
||||
NETWORKMODULECALL(OnRawMode2(pOpNick, *this, sModeArg, sArgs), m_pNetwork->GetUser(), m_pNetwork, NULL, NOTHING);
|
||||
NETWORKMODULECALL(OnRawMode2(pOpNick, *this, sModeArg, sArgs), m_pNetwork->GetUser(), m_pNetwork, nullptr, NOTHING);
|
||||
|
||||
for (unsigned int a = 0; a < sModeArg.size(); a++) {
|
||||
const unsigned char& uMode = sModeArg[a];
|
||||
@@ -325,19 +325,19 @@ void CChan::ModeChange(const CString& sModes, const CNick* pOpNick) {
|
||||
}
|
||||
}
|
||||
|
||||
NETWORKMODULECALL(OnChanPermission2(pOpNick, *pNick, *this, uMode, bAdd, bNoChange), m_pNetwork->GetUser(), m_pNetwork, NULL, NOTHING);
|
||||
NETWORKMODULECALL(OnChanPermission2(pOpNick, *pNick, *this, uMode, bAdd, bNoChange), m_pNetwork->GetUser(), m_pNetwork, nullptr, NOTHING);
|
||||
|
||||
if (uMode == CChan::M_Op) {
|
||||
if (bAdd) {
|
||||
NETWORKMODULECALL(OnOp2(pOpNick, *pNick, *this, bNoChange), m_pNetwork->GetUser(), m_pNetwork, NULL, NOTHING);
|
||||
NETWORKMODULECALL(OnOp2(pOpNick, *pNick, *this, bNoChange), m_pNetwork->GetUser(), m_pNetwork, nullptr, NOTHING);
|
||||
} else {
|
||||
NETWORKMODULECALL(OnDeop2(pOpNick, *pNick, *this, bNoChange), m_pNetwork->GetUser(), m_pNetwork, NULL, NOTHING);
|
||||
NETWORKMODULECALL(OnDeop2(pOpNick, *pNick, *this, bNoChange), m_pNetwork->GetUser(), m_pNetwork, nullptr, NOTHING);
|
||||
}
|
||||
} else if (uMode == CChan::M_Voice) {
|
||||
if (bAdd) {
|
||||
NETWORKMODULECALL(OnVoice2(pOpNick, *pNick, *this, bNoChange), m_pNetwork->GetUser(), m_pNetwork, NULL, NOTHING);
|
||||
NETWORKMODULECALL(OnVoice2(pOpNick, *pNick, *this, bNoChange), m_pNetwork->GetUser(), m_pNetwork, nullptr, NOTHING);
|
||||
} else {
|
||||
NETWORKMODULECALL(OnDevoice2(pOpNick, *pNick, *this, bNoChange), m_pNetwork->GetUser(), m_pNetwork, NULL, NOTHING);
|
||||
NETWORKMODULECALL(OnDevoice2(pOpNick, *pNick, *this, bNoChange), m_pNetwork->GetUser(), m_pNetwork, nullptr, NOTHING);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -372,7 +372,7 @@ void CChan::ModeChange(const CString& sModes, const CNick* pOpNick) {
|
||||
} else {
|
||||
bNoChange = !HasMode(uMode);
|
||||
}
|
||||
NETWORKMODULECALL(OnMode2(pOpNick, *this, uMode, sArg, bAdd, bNoChange), m_pNetwork->GetUser(), m_pNetwork, NULL, NOTHING);
|
||||
NETWORKMODULECALL(OnMode2(pOpNick, *this, uMode, sArg, bAdd, bNoChange), m_pNetwork->GetUser(), m_pNetwork, nullptr, NOTHING);
|
||||
|
||||
if (!bList) {
|
||||
(bAdd) ? AddMode(uMode, sArg) : RemMode(uMode);
|
||||
@@ -566,12 +566,12 @@ bool CChan::ChangeNick(const CString& sOldNick, const CString& sNewNick) {
|
||||
|
||||
const CNick* CChan::FindNick(const CString& sNick) const {
|
||||
map<CString,CNick>::const_iterator it = m_msNicks.find(sNick);
|
||||
return (it != m_msNicks.end()) ? &it->second : NULL;
|
||||
return (it != m_msNicks.end()) ? &it->second : nullptr;
|
||||
}
|
||||
|
||||
CNick* CChan::FindNick(const CString& sNick) {
|
||||
map<CString,CNick>::iterator it = m_msNicks.find(sNick);
|
||||
return (it != m_msNicks.end()) ? &it->second : NULL;
|
||||
return (it != m_msNicks.end()) ? &it->second : nullptr;
|
||||
}
|
||||
|
||||
void CChan::SendBuffer(CClient* pClient) {
|
||||
@@ -606,7 +606,7 @@ void CChan::SendBuffer(CClient* pClient, const CBuffer& Buffer) {
|
||||
pUseClient->SetPlaybackActive(true);
|
||||
|
||||
bool bSkipStatusMsg = pUseClient->HasServerTime();
|
||||
NETWORKMODULECALL(OnChanBufferStarting(*this, *pUseClient), m_pNetwork->GetUser(), m_pNetwork, NULL, &bSkipStatusMsg);
|
||||
NETWORKMODULECALL(OnChanBufferStarting(*this, *pUseClient), m_pNetwork->GetUser(), m_pNetwork, nullptr, &bSkipStatusMsg);
|
||||
|
||||
if (!bSkipStatusMsg) {
|
||||
m_pNetwork->PutUser(":***!znc@znc.in PRIVMSG " + GetName() + " :Buffer Playback...", pUseClient);
|
||||
@@ -629,13 +629,13 @@ void CChan::SendBuffer(CClient* pClient, const CBuffer& Buffer) {
|
||||
CUtils::SetMessageTags(sLine, msBatchTags);
|
||||
}
|
||||
bool bNotShowThisLine = false;
|
||||
NETWORKMODULECALL(OnChanBufferPlayLine2(*this, *pUseClient, sLine, BufLine.GetTime()), m_pNetwork->GetUser(), m_pNetwork, NULL, &bNotShowThisLine);
|
||||
NETWORKMODULECALL(OnChanBufferPlayLine2(*this, *pUseClient, sLine, BufLine.GetTime()), m_pNetwork->GetUser(), m_pNetwork, nullptr, &bNotShowThisLine);
|
||||
if (bNotShowThisLine) continue;
|
||||
m_pNetwork->PutUser(sLine, pUseClient);
|
||||
}
|
||||
|
||||
bSkipStatusMsg = pUseClient->HasServerTime();
|
||||
NETWORKMODULECALL(OnChanBufferEnding(*this, *pUseClient), m_pNetwork->GetUser(), m_pNetwork, NULL, &bSkipStatusMsg);
|
||||
NETWORKMODULECALL(OnChanBufferEnding(*this, *pUseClient), m_pNetwork->GetUser(), m_pNetwork, nullptr, &bSkipStatusMsg);
|
||||
if (!bSkipStatusMsg) {
|
||||
m_pNetwork->PutUser(":***!znc@znc.in PRIVMSG " + GetName() + " :Playback Complete.", pUseClient);
|
||||
}
|
||||
|
||||
+5
-5
@@ -72,7 +72,7 @@ CClient::~CClient() {
|
||||
CClientAuth* pAuth = (CClientAuth*) &(*m_spAuth);
|
||||
pAuth->Invalidate();
|
||||
}
|
||||
if (m_pUser != NULL) {
|
||||
if (m_pUser != nullptr) {
|
||||
m_pUser->AddBytesRead(GetBytesRead());
|
||||
m_pUser->AddBytesWritten(GetBytesWritten());
|
||||
}
|
||||
@@ -579,7 +579,7 @@ const CIRCSock* CClient::GetIRCSock() const {
|
||||
return m_pNetwork->GetIRCSock();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CIRCSock* CClient::GetIRCSock() {
|
||||
@@ -587,7 +587,7 @@ CIRCSock* CClient::GetIRCSock() {
|
||||
return m_pNetwork->GetIRCSock();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CClient::StatusCTCP(const CString& sLine) {
|
||||
@@ -645,7 +645,7 @@ CString CAuthBase::GetRemoteIP() const {
|
||||
}
|
||||
|
||||
void CAuthBase::Invalidate() {
|
||||
m_pSock = NULL;
|
||||
m_pSock = nullptr;
|
||||
}
|
||||
|
||||
void CAuthBase::AcceptLogin(CUser& User) {
|
||||
@@ -740,7 +740,7 @@ void CClient::ConnectionRefused() {
|
||||
void CClient::Disconnected() {
|
||||
DEBUG(GetSockName() << " == Disconnected()");
|
||||
CIRCNetwork* pNetwork = m_pNetwork;
|
||||
SetNetwork(NULL, true, false);
|
||||
SetNetwork(nullptr, true, false);
|
||||
|
||||
if (m_pUser) {
|
||||
NETWORKMODULECALL(OnClientDisconnect(), m_pUser, pNetwork, this, NOTHING);
|
||||
|
||||
@@ -312,7 +312,7 @@ void CClient::UserCommand(CString& sLine) {
|
||||
|
||||
CString sArgs = sLine.Token(1, true);
|
||||
sArgs.Trim();
|
||||
CServer *pServer = NULL;
|
||||
CServer *pServer = nullptr;
|
||||
|
||||
if (!sArgs.empty()) {
|
||||
pServer = m_pNetwork->FindServer(sArgs);
|
||||
@@ -539,7 +539,7 @@ void CClient::UserCommand(CString& sLine) {
|
||||
}
|
||||
|
||||
if (m_pNetwork && m_pNetwork->GetName().Equals(sNetwork)) {
|
||||
SetNetwork(NULL);
|
||||
SetNetwork(nullptr);
|
||||
}
|
||||
|
||||
if (m_pUser->DeleteNetwork(sNetwork)) {
|
||||
@@ -659,7 +659,7 @@ void CClient::UserCommand(CString& sLine) {
|
||||
pNewNetwork->Clone(*pOldNetwork, false);
|
||||
|
||||
if (m_pNetwork && m_pNetwork->GetName().Equals(sOldNetwork) && m_pUser == pOldUser) {
|
||||
SetNetwork(NULL);
|
||||
SetNetwork(nullptr);
|
||||
}
|
||||
|
||||
if (pOldUser->DeleteNetwork(sOldNetwork)) {
|
||||
@@ -1003,10 +1003,10 @@ void CClient::UserCommand(CString& sLine) {
|
||||
|
||||
switch (eType) {
|
||||
case CModInfo::GlobalModule:
|
||||
b = CZNC::Get().GetModules().LoadModule(sMod, sArgs, eType, NULL, NULL, sModRet);
|
||||
b = CZNC::Get().GetModules().LoadModule(sMod, sArgs, eType, nullptr, nullptr, sModRet);
|
||||
break;
|
||||
case CModInfo::UserModule:
|
||||
b = m_pUser->GetModules().LoadModule(sMod, sArgs, eType, m_pUser, NULL, sModRet);
|
||||
b = m_pUser->GetModules().LoadModule(sMod, sArgs, eType, m_pUser, nullptr, sModRet);
|
||||
break;
|
||||
case CModInfo::NetworkModule:
|
||||
b = m_pNetwork->GetModules().LoadModule(sMod, sArgs, eType, m_pUser, m_pNetwork, sModRet);
|
||||
@@ -1142,10 +1142,10 @@ void CClient::UserCommand(CString& sLine) {
|
||||
|
||||
switch (eType) {
|
||||
case CModInfo::GlobalModule:
|
||||
CZNC::Get().GetModules().ReloadModule(sMod, sArgs, NULL, NULL, sModRet);
|
||||
CZNC::Get().GetModules().ReloadModule(sMod, sArgs, nullptr, nullptr, sModRet);
|
||||
break;
|
||||
case CModInfo::UserModule:
|
||||
m_pUser->GetModules().ReloadModule(sMod, sArgs, m_pUser, NULL, sModRet);
|
||||
m_pUser->GetModules().ReloadModule(sMod, sArgs, m_pUser, nullptr, sModRet);
|
||||
break;
|
||||
case CModInfo::NetworkModule:
|
||||
m_pNetwork->GetModules().ReloadModule(sMod, sArgs, m_pUser, m_pNetwork, sModRet);
|
||||
|
||||
+3
-3
@@ -31,7 +31,7 @@ struct ConfigStackEntry {
|
||||
};
|
||||
|
||||
CConfigEntry::CConfigEntry()
|
||||
: m_pSubConfig(NULL) {
|
||||
: m_pSubConfig(nullptr) {
|
||||
}
|
||||
|
||||
CConfigEntry::CConfigEntry(const CConfig& Config)
|
||||
@@ -39,7 +39,7 @@ CConfigEntry::CConfigEntry(const CConfig& Config)
|
||||
}
|
||||
|
||||
CConfigEntry::CConfigEntry(const CConfigEntry& other)
|
||||
: m_pSubConfig(NULL) {
|
||||
: m_pSubConfig(nullptr) {
|
||||
if (other.m_pSubConfig)
|
||||
m_pSubConfig = new CConfig(*other.m_pSubConfig);
|
||||
}
|
||||
@@ -54,7 +54,7 @@ CConfigEntry& CConfigEntry::operator=(const CConfigEntry& other) {
|
||||
if (other.m_pSubConfig)
|
||||
m_pSubConfig = new CConfig(*other.m_pSubConfig);
|
||||
else
|
||||
m_pSubConfig = NULL;
|
||||
m_pSubConfig = nullptr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -648,7 +648,7 @@ int CExecSock::popen2(int & iReadFD, int & iWriteFD, const CString & sCommand) {
|
||||
"sh",
|
||||
"-c",
|
||||
sCommand.c_str(),
|
||||
NULL
|
||||
nullptr
|
||||
};
|
||||
execvp("sh", (char * const *) pArgv);
|
||||
// if execvp returns, there was an error
|
||||
@@ -668,9 +668,9 @@ int CExecSock::popen2(int & iReadFD, int & iWriteFD, const CString & sCommand) {
|
||||
void CExecSock::close2(int iPid, int iReadFD, int iWriteFD) {
|
||||
close(iReadFD);
|
||||
close(iWriteFD);
|
||||
time_t iNow = time(NULL);
|
||||
while (waitpid(iPid, NULL, WNOHANG) == 0) {
|
||||
if ((time(NULL) - iNow) > 5)
|
||||
time_t iNow = time(nullptr);
|
||||
while (waitpid(iPid, nullptr, WNOHANG) == 0) {
|
||||
if ((time(nullptr) - iNow) > 5)
|
||||
break; // giveup
|
||||
usleep(100);
|
||||
}
|
||||
|
||||
+24
-24
@@ -109,13 +109,13 @@ bool CIRCNetwork::IsValidNetwork(const CString& sNetwork) {
|
||||
}
|
||||
|
||||
CIRCNetwork::CIRCNetwork(CUser *pUser, const CString& sName) {
|
||||
m_pUser = NULL;
|
||||
m_pUser = nullptr;
|
||||
SetUser(pUser);
|
||||
m_sName = sName;
|
||||
|
||||
m_pModules = new CModules;
|
||||
|
||||
m_pIRCSock = NULL;
|
||||
m_pIRCSock = nullptr;
|
||||
m_uServerIdx = 0;
|
||||
|
||||
m_sChanPrefixes = "";
|
||||
@@ -143,12 +143,12 @@ CIRCNetwork::CIRCNetwork(CUser *pUser, const CString& sName) {
|
||||
}
|
||||
|
||||
CIRCNetwork::CIRCNetwork(CUser *pUser, const CIRCNetwork &Network) {
|
||||
m_pUser = NULL;
|
||||
m_pUser = nullptr;
|
||||
SetUser(pUser);
|
||||
|
||||
m_pModules = new CModules;
|
||||
|
||||
m_pIRCSock = NULL;
|
||||
m_pIRCSock = nullptr;
|
||||
m_uServerIdx = 0;
|
||||
|
||||
m_sChanPrefixes = "";
|
||||
@@ -278,7 +278,7 @@ void CIRCNetwork::Clone(const CIRCNetwork& Network, bool bCloneName) {
|
||||
CIRCNetwork::~CIRCNetwork() {
|
||||
if (m_pIRCSock) {
|
||||
CZNC::Get().GetManager().DelSockByAddr(m_pIRCSock);
|
||||
m_pIRCSock = NULL;
|
||||
m_pIRCSock = nullptr;
|
||||
}
|
||||
|
||||
// Delete clients
|
||||
@@ -292,7 +292,7 @@ CIRCNetwork::~CIRCNetwork() {
|
||||
|
||||
// Delete modules (this unloads all modules)
|
||||
delete m_pModules;
|
||||
m_pModules = NULL;
|
||||
m_pModules = nullptr;
|
||||
|
||||
// Delete Channels
|
||||
for (vector<CChan*>::const_iterator it = m_vChans.begin(); it != m_vChans.end(); ++it) {
|
||||
@@ -306,7 +306,7 @@ CIRCNetwork::~CIRCNetwork() {
|
||||
}
|
||||
m_vQueries.clear();
|
||||
|
||||
SetUser(NULL);
|
||||
SetUser(nullptr);
|
||||
|
||||
// Make sure we are not in the connection queue
|
||||
CZNC::Get().GetConnectionQueue().remove(this);
|
||||
@@ -617,7 +617,7 @@ void CIRCNetwork::ClientConnected(CClient *pClient) {
|
||||
}
|
||||
}
|
||||
|
||||
if (GetIRCSock() != NULL) {
|
||||
if (GetIRCSock() != nullptr) {
|
||||
CString sUserMode("");
|
||||
const set<unsigned char>& scUserModes = GetIRCSock()->GetUserModes();
|
||||
for (set<unsigned char>::const_iterator it = scUserModes.begin();
|
||||
@@ -658,7 +658,7 @@ void CIRCNetwork::ClientConnected(CClient *pClient) {
|
||||
const CBufLine& BufLine = m_NoticeBuffer.GetBufLine(uIdx);
|
||||
CString sLine = BufLine.GetLine(*pClient, msParams);
|
||||
bool bContinue = false;
|
||||
NETWORKMODULECALL(OnPrivBufferPlayLine2(*pClient, sLine, BufLine.GetTime()), m_pUser, this, NULL, &bContinue);
|
||||
NETWORKMODULECALL(OnPrivBufferPlayLine2(*pClient, sLine, BufLine.GetTime()), m_pUser, this, nullptr, &bContinue);
|
||||
if (bContinue) continue;
|
||||
pClient->PutClient(sLine);
|
||||
}
|
||||
@@ -703,7 +703,7 @@ std::vector<CClient*> CIRCNetwork::FindClients(const CString& sIdentifier) const
|
||||
void CIRCNetwork::SetUser(CUser *pUser) {
|
||||
for (unsigned int a = 0; a < m_vClients.size(); a++) {
|
||||
m_vClients[a]->PutStatus("This network is being deleted or moved to another user.");
|
||||
m_vClients[a]->SetNetwork(NULL);
|
||||
m_vClients[a]->SetNetwork(nullptr);
|
||||
}
|
||||
|
||||
m_vClients.clear();
|
||||
@@ -738,7 +738,7 @@ bool CIRCNetwork::PutUser(const CString& sLine, CClient* pClient, CClient* pSkip
|
||||
}
|
||||
}
|
||||
|
||||
return (pClient == NULL);
|
||||
return (pClient == nullptr);
|
||||
}
|
||||
|
||||
bool CIRCNetwork::PutStatus(const CString& sLine, CClient* pClient, CClient* pSkipClient) {
|
||||
@@ -752,7 +752,7 @@ bool CIRCNetwork::PutStatus(const CString& sLine, CClient* pClient, CClient* pSk
|
||||
}
|
||||
}
|
||||
|
||||
return (pClient == NULL);
|
||||
return (pClient == nullptr);
|
||||
}
|
||||
|
||||
bool CIRCNetwork::PutModule(const CString& sModule, const CString& sLine, CClient* pClient, CClient* pSkipClient) {
|
||||
@@ -766,7 +766,7 @@ bool CIRCNetwork::PutModule(const CString& sModule, const CString& sLine, CClien
|
||||
}
|
||||
}
|
||||
|
||||
return (pClient == NULL);
|
||||
return (pClient == nullptr);
|
||||
}
|
||||
|
||||
// Channels
|
||||
@@ -786,7 +786,7 @@ CChan* CIRCNetwork::FindChan(CString sName) const {
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::vector<CChan*> CIRCNetwork::FindChans(const CString& sWild) const {
|
||||
@@ -907,7 +907,7 @@ void CIRCNetwork::JoinChans(set<CChan*>& sChans) {
|
||||
|
||||
bool CIRCNetwork::JoinChan(CChan* pChan) {
|
||||
bool bReturn = false;
|
||||
NETWORKMODULECALL(OnJoining(*pChan), m_pUser, this, NULL, &bReturn);
|
||||
NETWORKMODULECALL(OnJoining(*pChan), m_pUser, this, nullptr, &bReturn);
|
||||
|
||||
if (bReturn)
|
||||
return false;
|
||||
@@ -918,7 +918,7 @@ bool CIRCNetwork::JoinChan(CChan* pChan) {
|
||||
} else {
|
||||
pChan->IncJoinTries();
|
||||
bool bFailed = false;
|
||||
NETWORKMODULECALL(OnTimerAutoJoin(*pChan), m_pUser, this, NULL, &bFailed);
|
||||
NETWORKMODULECALL(OnTimerAutoJoin(*pChan), m_pUser, this, nullptr, &bFailed);
|
||||
if (bFailed) return false;
|
||||
return true;
|
||||
}
|
||||
@@ -946,7 +946,7 @@ CQuery* CIRCNetwork::FindQuery(const CString& sName) const {
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::vector<CQuery*> CIRCNetwork::FindQueries(const CString& sWild) const {
|
||||
@@ -962,7 +962,7 @@ std::vector<CQuery*> CIRCNetwork::FindQueries(const CString& sWild) const {
|
||||
|
||||
CQuery* CIRCNetwork::AddQuery(const CString& sName) {
|
||||
if (sName.empty()) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CQuery* pQuery = FindQuery(sName);
|
||||
@@ -1005,7 +1005,7 @@ CServer* CIRCNetwork::FindServer(const CString& sName) const {
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool CIRCNetwork::DelServer(const CString& sName, unsigned short uPort, const CString& sPass) {
|
||||
@@ -1129,7 +1129,7 @@ bool CIRCNetwork::AddServer(const CString& sName, unsigned short uPort, const CS
|
||||
|
||||
CServer* CIRCNetwork::GetNextServer() {
|
||||
if (m_vServers.empty()) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (m_uServerIdx >= m_vServers.size()) {
|
||||
@@ -1143,7 +1143,7 @@ CServer* CIRCNetwork::GetCurrentServer() const {
|
||||
size_t uIdx = (m_uServerIdx) ? m_uServerIdx -1 : 0;
|
||||
|
||||
if (uIdx >= m_vServers.size()) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return m_vServers[uIdx];
|
||||
@@ -1223,7 +1223,7 @@ bool CIRCNetwork::Connect() {
|
||||
DEBUG("Connecting user/network [" << m_pUser->GetUserName() << "/" << m_sName << "]");
|
||||
|
||||
bool bAbort = false;
|
||||
NETWORKMODULECALL(OnIRCConnecting(pIRCSock), m_pUser, this, NULL, &bAbort);
|
||||
NETWORKMODULECALL(OnIRCConnecting(pIRCSock), m_pUser, this, nullptr, &bAbort);
|
||||
if (bAbort) {
|
||||
DEBUG("Some module aborted the connection attempt");
|
||||
PutStatus("Some module aborted the connection attempt");
|
||||
@@ -1256,7 +1256,7 @@ void CIRCNetwork::IRCConnected() {
|
||||
}
|
||||
|
||||
void CIRCNetwork::IRCDisconnected() {
|
||||
m_pIRCSock = NULL;
|
||||
m_pIRCSock = nullptr;
|
||||
|
||||
SetIRCServer("");
|
||||
m_bIRCAway = false;
|
||||
@@ -1281,7 +1281,7 @@ void CIRCNetwork::SetIRCConnectEnabled(bool b) {
|
||||
|
||||
void CIRCNetwork::CheckIRCConnect() {
|
||||
// Do we want to connect?
|
||||
if (GetIRCConnectEnabled() && GetIRCSock() == NULL)
|
||||
if (GetIRCConnectEnabled() && GetIRCSock() == nullptr)
|
||||
CZNC::Get().AddNetworkToQueue(this);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -736,7 +736,7 @@ void CIRCSock::ReadLine(const CString& sData) {
|
||||
if (bReturn) return;
|
||||
|
||||
pChan->SetTopicOwner(Nick.GetNick());
|
||||
pChan->SetTopicDate((unsigned long) time(NULL));
|
||||
pChan->SetTopicDate((unsigned long) time(nullptr));
|
||||
pChan->SetTopic(sTopic);
|
||||
|
||||
if (pChan->IsDetached()) {
|
||||
@@ -954,7 +954,7 @@ bool CIRCSock::OnGeneralCTCP(CNick& Nick, CString& sMessage) {
|
||||
}
|
||||
|
||||
if (!sReply.empty()) {
|
||||
time_t now = time(NULL);
|
||||
time_t now = time(nullptr);
|
||||
// If the last CTCP is older than m_uCTCPFloodTime, reset the counter
|
||||
if (m_lastCTCP + m_uCTCPFloodTime < now)
|
||||
m_uNumCTCP = 0;
|
||||
|
||||
+2
-2
@@ -46,7 +46,7 @@ bool CListener::Listen() {
|
||||
}
|
||||
|
||||
void CListener::ResetRealListener() {
|
||||
m_pListener = NULL;
|
||||
m_pListener = nullptr;
|
||||
}
|
||||
|
||||
CRealListener::~CRealListener() {
|
||||
@@ -114,7 +114,7 @@ void CIncomingConnection::ReadLine(const CString& sLine) {
|
||||
|| (m_eAcceptType == CListener::ACCEPT_HTTP);
|
||||
bool bAcceptIRC = (m_eAcceptType == CListener::ACCEPT_ALL)
|
||||
|| (m_eAcceptType == CListener::ACCEPT_IRC);
|
||||
Csock *pSock = NULL;
|
||||
Csock *pSock = nullptr;
|
||||
|
||||
if (!bIsHTTP) {
|
||||
// Let's assume it's an IRC connection
|
||||
|
||||
+20
-20
@@ -133,7 +133,7 @@ CModule::CModule(ModHandle pDLL, CUser* pUser, CIRCNetwork* pNetwork, const CStr
|
||||
m_pManager = &(CZNC::Get().GetManager());;
|
||||
m_pUser = pUser;
|
||||
m_pNetwork = pNetwork;
|
||||
m_pClient = NULL;
|
||||
m_pClient = nullptr;
|
||||
m_sModName = sModName;
|
||||
m_sDataDir = sDataDir;
|
||||
|
||||
@@ -330,7 +330,7 @@ bool CModule::UnlinkTimer(CTimer* pTimer) {
|
||||
|
||||
CTimer* CModule::FindTimer(const CString& sLabel) {
|
||||
if (sLabel.empty()) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
set<CTimer*>::iterator it;
|
||||
@@ -341,7 +341,7 @@ CTimer* CModule::FindTimer(const CString& sLabel) {
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CModule::ListTimers() {
|
||||
@@ -430,7 +430,7 @@ CSocket* CModule::FindSocket(const CString& sSockName) {
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CModule::ListSockets() {
|
||||
@@ -483,7 +483,7 @@ void CModule::AddJob(CModuleJob *pJob)
|
||||
|
||||
void CModule::CancelJob(CModuleJob *pJob)
|
||||
{
|
||||
if (pJob == NULL)
|
||||
if (pJob == nullptr)
|
||||
return;
|
||||
// Destructor calls UnlinkJob and removes the job from m_sJobs
|
||||
CThreadPool::Get().cancelJob(pJob);
|
||||
@@ -517,11 +517,11 @@ bool CModule::UnlinkJob(CModuleJob *pJob)
|
||||
|
||||
bool CModule::AddCommand(const CModCommand& Command)
|
||||
{
|
||||
if (Command.GetFunction() == NULL)
|
||||
if (Command.GetFunction() == nullptr)
|
||||
return false;
|
||||
if (Command.GetCommand().find(' ') != CString::npos)
|
||||
return false;
|
||||
if (FindCommand(Command.GetCommand()) != NULL)
|
||||
if (FindCommand(Command.GetCommand()) != nullptr)
|
||||
return false;
|
||||
|
||||
m_mCommands[Command.GetCommand()] = Command;
|
||||
@@ -557,7 +557,7 @@ const CModCommand* CModule::FindCommand(const CString& sCmd) const
|
||||
continue;
|
||||
return &it->second;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool CModule::HandleCommand(const CString& sLine) {
|
||||
@@ -785,9 +785,9 @@ void CModule::OnGetAvailableMods(set<CModInfo>& ssMods, CModInfo::EModuleType eT
|
||||
|
||||
|
||||
CModules::CModules() {
|
||||
m_pUser = NULL;
|
||||
m_pNetwork = NULL;
|
||||
m_pClient = NULL;
|
||||
m_pUser = nullptr;
|
||||
m_pNetwork = nullptr;
|
||||
m_pClient = nullptr;
|
||||
}
|
||||
|
||||
CModules::~CModules() {
|
||||
@@ -1012,20 +1012,20 @@ CModule* CModules::FindModule(const CString& sModule) const {
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool CModules::LoadModule(const CString& sModule, const CString& sArgs, CModInfo::EModuleType eType, CUser* pUser, CIRCNetwork *pNetwork, CString& sRetMsg) {
|
||||
sRetMsg = "";
|
||||
|
||||
if (FindModule(sModule) != NULL) {
|
||||
if (FindModule(sModule) != nullptr) {
|
||||
sRetMsg = "Module [" + sModule + "] already loaded.";
|
||||
return false;
|
||||
}
|
||||
|
||||
bool bSuccess;
|
||||
bool bHandled = false;
|
||||
_GLOBALMODULECALL(OnModuleLoading(sModule, sArgs, eType, bSuccess, sRetMsg), pUser, pNetwork, NULL, &bHandled);
|
||||
_GLOBALMODULECALL(OnModuleLoading(sModule, sArgs, eType, bSuccess, sRetMsg), pUser, pNetwork, nullptr, &bHandled);
|
||||
if (bHandled) return bSuccess;
|
||||
|
||||
CString sModPath, sDataPath;
|
||||
@@ -1115,7 +1115,7 @@ bool CModules::UnloadModule(const CString& sModule, CString& sRetMsg) {
|
||||
|
||||
bool bSuccess;
|
||||
bool bHandled = false;
|
||||
_GLOBALMODULECALL(OnModuleUnloading(pModule, bSuccess, sRetMsg), pModule->GetUser(), pModule->GetNetwork(), NULL, &bHandled);
|
||||
_GLOBALMODULECALL(OnModuleUnloading(pModule, bSuccess, sRetMsg), pModule->GetUser(), pModule->GetNetwork(), nullptr, &bHandled);
|
||||
if (bHandled) return bSuccess;
|
||||
|
||||
ModHandle p = pModule->GetDLL();
|
||||
@@ -1150,7 +1150,7 @@ bool CModules::ReloadModule(const CString& sModule, const CString& sArgs, CUser*
|
||||
}
|
||||
|
||||
CModInfo::EModuleType eType = pModule->GetType();
|
||||
pModule = NULL;
|
||||
pModule = nullptr;
|
||||
|
||||
sRetMsg = "";
|
||||
if (!UnloadModule(sMod, sRetMsg)) {
|
||||
@@ -1306,7 +1306,7 @@ ModHandle CModules::OpenModule(const CString& sModule, const CString& sModPath,
|
||||
for (unsigned int a = 0; a < sModule.length(); a++) {
|
||||
if (((sModule[a] < '0') || (sModule[a] > '9')) && ((sModule[a] < 'a') || (sModule[a] > 'z')) && ((sModule[a] < 'A') || (sModule[a] > 'Z')) && (sModule[a] != '_')) {
|
||||
sRetMsg = "Module names can only contain letters, numbers and underscores, [" + sModule + "] is invalid.";
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1330,7 +1330,7 @@ ModHandle CModules::OpenModule(const CString& sModule, const CString& sModPath,
|
||||
const char* cDlError = dlerror();
|
||||
CString sDlError = cDlError ? cDlError : "Unknown error";
|
||||
sRetMsg = "Unable to open module [" + sModule + "] [" + sDlError + "]";
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
typedef bool (*InfoFP)(double, CModInfo&);
|
||||
@@ -1339,7 +1339,7 @@ ModHandle CModules::OpenModule(const CString& sModule, const CString& sModPath,
|
||||
if (!ZNCModInfo) {
|
||||
dlclose(p);
|
||||
sRetMsg = "Could not find ZNCModInfo() in module [" + sModule + "]";
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (ZNCModInfo(CModule::GetCoreVersion(), Info)) {
|
||||
@@ -1354,7 +1354,7 @@ ModHandle CModules::OpenModule(const CString& sModule, const CString& sModPath,
|
||||
}
|
||||
|
||||
CModCommand::CModCommand()
|
||||
: m_sCmd(), m_pFunc(NULL), m_sArgs(), m_sDesc()
|
||||
: m_sCmd(), m_pFunc(nullptr), m_sArgs(), m_sDesc()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -34,7 +34,7 @@ CNick::~CNick() {}
|
||||
|
||||
void CNick::Reset() {
|
||||
m_sChanPerms.clear();
|
||||
m_pNetwork = NULL;
|
||||
m_pNetwork = nullptr;
|
||||
}
|
||||
|
||||
void CNick::Parse(const CString& sNickMask) {
|
||||
@@ -115,7 +115,7 @@ bool CNick::RemPerm(unsigned char uPerm) {
|
||||
}
|
||||
|
||||
unsigned char CNick::GetPermChar() const {
|
||||
CIRCSock* pIRCSock = (!m_pNetwork) ? NULL : m_pNetwork->GetIRCSock();
|
||||
CIRCSock* pIRCSock = (!m_pNetwork) ? nullptr : m_pNetwork->GetIRCSock();
|
||||
const CString& sChanPerms = (!pIRCSock) ? "@+" : pIRCSock->GetPerms();
|
||||
|
||||
for (unsigned int a = 0; a < sChanPerms.size(); a++) {
|
||||
@@ -129,7 +129,7 @@ unsigned char CNick::GetPermChar() const {
|
||||
}
|
||||
|
||||
CString CNick::GetPermStr() const {
|
||||
CIRCSock* pIRCSock = (!m_pNetwork) ? NULL : m_pNetwork->GetIRCSock();
|
||||
CIRCSock* pIRCSock = (!m_pNetwork) ? nullptr : m_pNetwork->GetIRCSock();
|
||||
const CString& sChanPerms = (!pIRCSock) ? "@+" : pIRCSock->GetPerms();
|
||||
CString sRet;
|
||||
|
||||
|
||||
+1
-1
@@ -73,7 +73,7 @@ void CQuery::SendBuffer(CClient* pClient, const CBuffer& Buffer) {
|
||||
CUtils::SetMessageTags(sLine, msBatchTags);
|
||||
}
|
||||
bool bContinue = false;
|
||||
NETWORKMODULECALL(OnPrivBufferPlayLine2(*pUseClient, sLine, BufLine.GetTime()), m_pNetwork->GetUser(), m_pNetwork, NULL, &bContinue);
|
||||
NETWORKMODULECALL(OnPrivBufferPlayLine2(*pUseClient, sLine, BufLine.GetTime()), m_pNetwork->GetUser(), m_pNetwork, nullptr, &bContinue);
|
||||
if (bContinue) continue;
|
||||
m_pNetwork->PutUser(sLine, pUseClient);
|
||||
}
|
||||
|
||||
+8
-8
@@ -175,7 +175,7 @@ void CSockManager::CDNSJob::runThread() {
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
hints.ai_protocol = IPPROTO_TCP;
|
||||
hints.ai_flags = AI_ADDRCONFIG;
|
||||
iRes = getaddrinfo(sHostname.c_str(), NULL, &hints, &aiResult);
|
||||
iRes = getaddrinfo(sHostname.c_str(), nullptr, &hints, &aiResult);
|
||||
if (EAGAIN != iRes) {
|
||||
break;
|
||||
}
|
||||
@@ -195,7 +195,7 @@ void CSockManager::CDNSJob::runMain() {
|
||||
if (this->aiResult) {
|
||||
DEBUG("And aiResult is not NULL...");
|
||||
}
|
||||
this->aiResult = NULL; // just for case. Maybe to call freeaddrinfo()?
|
||||
this->aiResult = nullptr; // just for case. Maybe to call freeaddrinfo()?
|
||||
}
|
||||
pManager->SetTDNSThreadFinished(this->task, this->bBind, this->aiResult);
|
||||
}
|
||||
@@ -207,7 +207,7 @@ void CSockManager::StartTDNSThread(TDNSTask* task, bool bBind) {
|
||||
arg->task = task;
|
||||
arg->bBind = bBind;
|
||||
arg->iRes = 0;
|
||||
arg->aiResult = NULL;
|
||||
arg->aiResult = nullptr;
|
||||
arg->pManager = this;
|
||||
|
||||
CThreadPool::Get().addJob(arg);
|
||||
@@ -256,7 +256,7 @@ void CSockManager::SetTDNSThreadFinished(TDNSTask* task, bool bBind, addrinfo* a
|
||||
SCString ssTargets6;
|
||||
for (addrinfo* ai = task->aiTarget; ai; ai = ai->ai_next) {
|
||||
char s[INET6_ADDRSTRLEN] = {};
|
||||
getnameinfo(ai->ai_addr, ai->ai_addrlen, s, sizeof(s), NULL, 0, NI_NUMERICHOST);
|
||||
getnameinfo(ai->ai_addr, ai->ai_addrlen, s, sizeof(s), nullptr, 0, NI_NUMERICHOST);
|
||||
switch (ai->ai_family) {
|
||||
case AF_INET:
|
||||
ssTargets4.insert(s);
|
||||
@@ -272,7 +272,7 @@ void CSockManager::SetTDNSThreadFinished(TDNSTask* task, bool bBind, addrinfo* a
|
||||
SCString ssBinds6;
|
||||
for (addrinfo* ai = task->aiBind; ai; ai = ai->ai_next) {
|
||||
char s[INET6_ADDRSTRLEN] = {};
|
||||
getnameinfo(ai->ai_addr, ai->ai_addrlen, s, sizeof(s), NULL, 0, NI_NUMERICHOST);
|
||||
getnameinfo(ai->ai_addr, ai->ai_addrlen, s, sizeof(s), nullptr, 0, NI_NUMERICHOST);
|
||||
switch (ai->ai_family) {
|
||||
case AF_INET:
|
||||
ssBinds4.insert(s);
|
||||
@@ -361,8 +361,8 @@ void CSockManager::Connect(const CString& sHostname, u_short iPort, const CStrin
|
||||
task->bSSL = bSSL;
|
||||
task->sBindhost = sBindHost;
|
||||
task->pcSock = pcSock;
|
||||
task->aiTarget = NULL;
|
||||
task->aiBind = NULL;
|
||||
task->aiTarget = nullptr;
|
||||
task->aiBind = nullptr;
|
||||
task->bDoneTarget = false;
|
||||
if (sBindHost.empty()) {
|
||||
task->bDoneBind = true;
|
||||
@@ -411,7 +411,7 @@ CSocket::CSocket(CModule* pModule, const CString& sHostname, unsigned short uPor
|
||||
}
|
||||
|
||||
CSocket::~CSocket() {
|
||||
CUser *pUser = NULL;
|
||||
CUser *pUser = nullptr;
|
||||
|
||||
// CWebSock could cause us to have a NULL pointer here
|
||||
if (m_pModule) {
|
||||
|
||||
+7
-7
@@ -48,7 +48,7 @@ CTemplate* CTemplateLoopContext::GetRow(unsigned int uIndex) {
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CString CTemplateLoopContext::GetValue(const CString& sName, bool bFromIf) {
|
||||
@@ -104,7 +104,7 @@ void CTemplate::Init() {
|
||||
*/
|
||||
|
||||
ClearPaths();
|
||||
m_pParent = NULL;
|
||||
m_pParent = nullptr;
|
||||
}
|
||||
|
||||
CString CTemplate::ExpandFile(const CString& sFilename, bool bFromInc) {
|
||||
@@ -241,7 +241,7 @@ CTemplate* CTemplate::GetRow(const CString& sName, unsigned int uIndex) {
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
vector<CTemplate*>* CTemplate::GetLoop(const CString& sName) {
|
||||
@@ -261,7 +261,7 @@ vector<CTemplate*>* CTemplate::GetLoop(const CString& sName) {
|
||||
return &(it->second);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool CTemplate::PrintString(CString& sRet) {
|
||||
@@ -456,7 +456,7 @@ bool CTemplate::Print(const CString& sFileName, ostream& oOut) {
|
||||
bool bSort = (sArgs.Token(1).Left(4).Equals("SORT"));
|
||||
vector<CTemplate*>* pvLoop = GetLoop(sLoopName);
|
||||
|
||||
if (bSort && pvLoop != NULL && pvLoop->size() > 1) {
|
||||
if (bSort && pvLoop != nullptr && pvLoop->size() > 1) {
|
||||
CString sKey;
|
||||
|
||||
if(sArgs.Token(1).TrimPrefix_n("SORT").Left(4).Equals("ASC=")) {
|
||||
@@ -652,7 +652,7 @@ CTemplateLoopContext* CTemplate::GetCurLoopContext() {
|
||||
return m_vLoopContexts.back();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool CTemplate::ValidIf(const CString& sArgs) {
|
||||
@@ -749,7 +749,7 @@ bool CTemplate::IsTrue(const CString& sName) {
|
||||
}
|
||||
|
||||
bool CTemplate::HasLoop(const CString& sName) {
|
||||
return (GetLoop(sName) != NULL);
|
||||
return (GetLoop(sName) != nullptr);
|
||||
}
|
||||
|
||||
CTemplate* CTemplate::GetParent(bool bRoot) {
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ void CThreadPool::handlePipeReadable() const {
|
||||
}
|
||||
|
||||
CJob *CThreadPool::getJobFromPipe() const {
|
||||
CJob* a = NULL;
|
||||
CJob* a = nullptr;
|
||||
ssize_t need = sizeof(a);
|
||||
ssize_t r = read(m_iJobPipe[0], &a, need);
|
||||
if (r != need) {
|
||||
|
||||
+19
-19
@@ -100,7 +100,7 @@ CUser::~CUser() {
|
||||
|
||||
// Delete modules (unloads all modules!)
|
||||
delete m_pModules;
|
||||
m_pModules = NULL;
|
||||
m_pModules = nullptr;
|
||||
|
||||
CZNC::Get().GetManager().DelCronByAddr(m_pUserTimer);
|
||||
|
||||
@@ -188,7 +188,7 @@ bool CUser::ParseConfig(CConfig* pConfig, CString& sError) {
|
||||
if (sValue.ToBool()) {
|
||||
CUtils::PrintAction("Loading Module [bouncedcc]");
|
||||
CString sModRet;
|
||||
bool bModRet = GetModules().LoadModule("bouncedcc", "", CModInfo::UserModule, this, NULL, sModRet);
|
||||
bool bModRet = GetModules().LoadModule("bouncedcc", "", CModInfo::UserModule, this, nullptr, sModRet);
|
||||
|
||||
CUtils::PrintStatus(bModRet, sModRet);
|
||||
if (!bModRet) {
|
||||
@@ -449,20 +449,20 @@ bool CUser::ParseConfig(CConfig* pConfig, CString& sError) {
|
||||
CIRCNetwork* CUser::AddNetwork(const CString &sNetwork, CString& sErrorRet) {
|
||||
if (!CIRCNetwork::IsValidNetwork(sNetwork)) {
|
||||
sErrorRet = "Invalid network name. It should be alphanumeric. Not to be confused with server name";
|
||||
return NULL;
|
||||
return nullptr;
|
||||
} else if (FindNetwork(sNetwork)) {
|
||||
sErrorRet = "Network [" + sNetwork.Token(0) + "] already exists";
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CIRCNetwork* pNetwork = new CIRCNetwork(this, sNetwork);
|
||||
|
||||
bool bCancel = false;
|
||||
USERMODULECALL(OnAddNetwork(*pNetwork, sErrorRet), this, NULL, &bCancel);
|
||||
USERMODULECALL(OnAddNetwork(*pNetwork, sErrorRet), this, nullptr, &bCancel);
|
||||
if(bCancel) {
|
||||
RemoveNetwork(pNetwork);
|
||||
delete pNetwork;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return pNetwork;
|
||||
@@ -492,7 +492,7 @@ bool CUser::DeleteNetwork(const CString& sNetwork) {
|
||||
|
||||
if (pNetwork) {
|
||||
bool bCancel = false;
|
||||
USERMODULECALL(OnDeleteNetwork(*pNetwork), this, NULL, &bCancel);
|
||||
USERMODULECALL(OnDeleteNetwork(*pNetwork), this, nullptr, &bCancel);
|
||||
if (!bCancel) {
|
||||
delete pNetwork;
|
||||
return true;
|
||||
@@ -510,7 +510,7 @@ CIRCNetwork* CUser::FindNetwork(const CString& sNetwork) const {
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const vector<CIRCNetwork*>& CUser::GetNetworks() const {
|
||||
@@ -523,7 +523,7 @@ CString CUser::ExpandString(const CString& sStr) const {
|
||||
}
|
||||
|
||||
CString& CUser::ExpandString(const CString& sStr, CString& sRet) const {
|
||||
CString sTime = CUtils::CTime(time(NULL), m_sTimezone);
|
||||
CString sTime = CUtils::CTime(time(nullptr), m_sTimezone);
|
||||
|
||||
sRet = sStr;
|
||||
sRet.Replace("%user%", GetUserName());
|
||||
@@ -648,7 +648,7 @@ void CUser::CloneNetworks(const CUser& User) {
|
||||
CClient *pClient = vClients.front();
|
||||
// This line will remove pClient from vClients,
|
||||
// because it's a reference to the internal Network's vector.
|
||||
pClient->SetNetwork(NULL);
|
||||
pClient->SetNetwork(nullptr);
|
||||
}
|
||||
|
||||
DeleteNetwork(*it);
|
||||
@@ -747,9 +747,9 @@ bool CUser::Clone(const CUser& User, CString& sErrorRet, bool bCloneNetworks) {
|
||||
CModule* pCurMod = vCurMods.FindModule(pNewMod->GetModName());
|
||||
|
||||
if (!pCurMod) {
|
||||
vCurMods.LoadModule(pNewMod->GetModName(), pNewMod->GetArgs(), CModInfo::UserModule, this, NULL, sModRet);
|
||||
vCurMods.LoadModule(pNewMod->GetModName(), pNewMod->GetArgs(), CModInfo::UserModule, this, nullptr, sModRet);
|
||||
} else if (pNewMod->GetArgs() != pCurMod->GetArgs()) {
|
||||
vCurMods.ReloadModule(pNewMod->GetModName(), pNewMod->GetArgs(), this, NULL, sModRet);
|
||||
vCurMods.ReloadModule(pNewMod->GetModName(), pNewMod->GetArgs(), this, nullptr, sModRet);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -989,7 +989,7 @@ bool CUser::PutUser(const CString& sLine, CClient* pClient, CClient* pSkipClient
|
||||
}
|
||||
}
|
||||
|
||||
return (pClient == NULL);
|
||||
return (pClient == nullptr);
|
||||
}
|
||||
|
||||
bool CUser::PutAllUser(const CString& sLine, CClient* pClient, CClient* pSkipClient) {
|
||||
@@ -1002,7 +1002,7 @@ bool CUser::PutAllUser(const CString& sLine, CClient* pClient, CClient* pSkipCli
|
||||
}
|
||||
}
|
||||
|
||||
return (pClient == NULL);
|
||||
return (pClient == nullptr);
|
||||
}
|
||||
|
||||
bool CUser::PutStatus(const CString& sLine, CClient* pClient, CClient* pSkipClient) {
|
||||
@@ -1017,7 +1017,7 @@ bool CUser::PutStatus(const CString& sLine, CClient* pClient, CClient* pSkipClie
|
||||
}
|
||||
}
|
||||
|
||||
return (pClient == NULL);
|
||||
return (pClient == nullptr);
|
||||
}
|
||||
|
||||
bool CUser::PutStatusNotice(const CString& sLine, CClient* pClient, CClient* pSkipClient) {
|
||||
@@ -1032,7 +1032,7 @@ bool CUser::PutStatusNotice(const CString& sLine, CClient* pClient, CClient* pSk
|
||||
}
|
||||
}
|
||||
|
||||
return (pClient == NULL);
|
||||
return (pClient == nullptr);
|
||||
}
|
||||
|
||||
bool CUser::PutModule(const CString& sModule, const CString& sLine, CClient* pClient, CClient* pSkipClient) {
|
||||
@@ -1046,7 +1046,7 @@ bool CUser::PutModule(const CString& sModule, const CString& sLine, CClient* pCl
|
||||
}
|
||||
}
|
||||
|
||||
return (pClient == NULL);
|
||||
return (pClient == nullptr);
|
||||
}
|
||||
|
||||
bool CUser::PutModNotice(const CString& sModule, const CString& sLine, CClient* pClient, CClient* pSkipClient) {
|
||||
@@ -1060,7 +1060,7 @@ bool CUser::PutModNotice(const CString& sModule, const CString& sLine, CClient*
|
||||
}
|
||||
}
|
||||
|
||||
return (pClient == NULL);
|
||||
return (pClient == nullptr);
|
||||
}
|
||||
|
||||
CString CUser::MakeCleanUserName(const CString& sUserName) {
|
||||
@@ -1116,7 +1116,7 @@ bool CUser::LoadModule(const CString& sModName, const CString& sArgs, const CStr
|
||||
}
|
||||
}
|
||||
} else {
|
||||
bModRet = GetModules().LoadModule(sModName, sArgs, CModInfo::UserModule, this, NULL, sModRet);
|
||||
bModRet = GetModules().LoadModule(sModName, sArgs, CModInfo::UserModule, this, nullptr, sModRet);
|
||||
}
|
||||
|
||||
if (!bModRet) {
|
||||
|
||||
+1
-1
@@ -270,7 +270,7 @@ bool CUtils::GetInput(const CString& sPrompt, CString& sRet, const CString& sDef
|
||||
PrintPrompt(sPrompt + sExtra);
|
||||
char szBuf[1024];
|
||||
memset(szBuf, 0, 1024);
|
||||
if (fgets(szBuf, 1024, stdin) == NULL) {
|
||||
if (fgets(szBuf, 1024, stdin) == nullptr) {
|
||||
// Reading failed (Error? EOF?)
|
||||
PrintError("Error while reading from stdin. Exiting...");
|
||||
exit(-1);
|
||||
|
||||
+11
-11
@@ -97,7 +97,7 @@ bool CZNCTagHandler::HandleTag(CTemplate& Tmpl, const CString& sName, const CStr
|
||||
}
|
||||
|
||||
CWebSession::CWebSession(const CString& sId, const CString& sIP) : m_sId(sId), m_sIP(sIP) {
|
||||
m_pUser = NULL;
|
||||
m_pUser = nullptr;
|
||||
Sessions.m_mIPSessions.insert(make_pair(sIP, this));
|
||||
UpdateLastActive();
|
||||
}
|
||||
@@ -174,7 +174,7 @@ void CWebAuth::RefusedLogin(const CString& sReason) {
|
||||
std::shared_ptr<CWebSession> spSession = m_pWebSock->GetSession();
|
||||
|
||||
spSession->AddError("Invalid login!");
|
||||
spSession->SetUser(NULL);
|
||||
spSession->SetUser(nullptr);
|
||||
|
||||
m_pWebSock->SetLoggedIn(false);
|
||||
m_pWebSock->UnPauseRead();
|
||||
@@ -186,10 +186,10 @@ void CWebAuth::RefusedLogin(const CString& sReason) {
|
||||
|
||||
void CWebAuth::Invalidate() {
|
||||
CAuthBase::Invalidate();
|
||||
m_pWebSock = NULL;
|
||||
m_pWebSock = nullptr;
|
||||
}
|
||||
|
||||
CWebSock::CWebSock(const CString& sURIPrefix) : CHTTPSock(NULL, sURIPrefix) {
|
||||
CWebSock::CWebSock(const CString& sURIPrefix) : CHTTPSock(nullptr, sURIPrefix) {
|
||||
m_bPathsSet = false;
|
||||
|
||||
m_Template.AddTagHandler(std::make_shared<CZNCTagHandler>(*this));
|
||||
@@ -325,7 +325,7 @@ void CWebSock::SetPaths(CModule* pModule, bool bIsTemplate) {
|
||||
void CWebSock::SetVars() {
|
||||
m_Template["SessionUser"] = GetUser();
|
||||
m_Template["SessionIP"] = GetRemoteIP();
|
||||
m_Template["Tag"] = CZNC::GetTag(GetSession()->GetUser() != NULL, true);
|
||||
m_Template["Tag"] = CZNC::GetTag(GetSession()->GetUser() != nullptr, true);
|
||||
m_Template["Version"] = CZNC::GetVersion();
|
||||
m_Template["SkinName"] = GetSkinName();
|
||||
m_Template["_CSRF_Check"] = GetCSRFCheck();
|
||||
@@ -622,7 +622,7 @@ CWebSock::EPageReqResult CWebSock::OnPageRequestInternal(const CString& sURI, CS
|
||||
} else if (sURI == "/robots.txt") {
|
||||
return PrintStaticFile("/pub/robots.txt", sPageRet);
|
||||
} else if (sURI == "/logout") {
|
||||
GetSession()->SetUser(NULL);
|
||||
GetSession()->SetUser(nullptr);
|
||||
SetLoggedIn(false);
|
||||
Redirect("/");
|
||||
|
||||
@@ -694,7 +694,7 @@ CWebSock::EPageReqResult CWebSock::OnPageRequestInternal(const CString& sURI, CS
|
||||
return PAGE_DONE;
|
||||
}
|
||||
|
||||
CIRCNetwork *pNetwork = NULL;
|
||||
CIRCNetwork *pNetwork = nullptr;
|
||||
if (eModType == CModInfo::NetworkModule) {
|
||||
CString sNetwork = m_sPath.Token(0, false, "/");
|
||||
m_sPath = m_sPath.Token(1, true, "/");
|
||||
@@ -716,7 +716,7 @@ CWebSock::EPageReqResult CWebSock::OnPageRequestInternal(const CString& sURI, CS
|
||||
|
||||
DEBUG("Path [" + m_sPath + "], Module [" + m_sModName + "], Page [" + m_sPage + "]");
|
||||
|
||||
CModule *pModule = NULL;
|
||||
CModule *pModule = nullptr;
|
||||
|
||||
switch (eModType) {
|
||||
case CModInfo::GlobalModule:
|
||||
@@ -831,7 +831,7 @@ std::shared_ptr<CWebSession> CWebSock::GetSession() {
|
||||
const CString sCookieSessionId = GetRequestCookie("SessionId");
|
||||
std::shared_ptr<CWebSession> *pSession = Sessions.m_mspSessions.GetItem(sCookieSessionId);
|
||||
|
||||
if (pSession != NULL) {
|
||||
if (pSession != nullptr) {
|
||||
// Refresh the timeout
|
||||
Sessions.m_mspSessions.AddItem((*pSession)->GetId(), *pSession);
|
||||
(*pSession)->UpdateLastActive();
|
||||
@@ -853,7 +853,7 @@ std::shared_ptr<CWebSession> CWebSock::GetSession() {
|
||||
sSessionID = CString::RandomString(32);
|
||||
sSessionID += ":" + GetRemoteIP() + ":" + CString(GetRemotePort());
|
||||
sSessionID += ":" + GetLocalIP() + ":" + CString(GetLocalPort());
|
||||
sSessionID += ":" + CString(time(NULL));
|
||||
sSessionID += ":" + CString(time(nullptr));
|
||||
sSessionID = sSessionID.SHA256();
|
||||
|
||||
DEBUG("Auto generated session: [" + sSessionID + "]");
|
||||
@@ -889,7 +889,7 @@ Csock* CWebSock::GetSockObj(const CString& sHost, unsigned short uPort) {
|
||||
// All listening is done by CListener, thus CWebSock should never have
|
||||
// to listen, but since GetSockObj() is pure virtual...
|
||||
DEBUG("CWebSock::GetSockObj() called - this should never happen!");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CString CWebSock::GetSkinName() {
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ bool CDebug::debug =
|
||||
|
||||
CDebugStream::~CDebugStream() {
|
||||
timeval tTime;
|
||||
gettimeofday(&tTime, NULL);
|
||||
gettimeofday(&tTime, nullptr);
|
||||
time_t tSec = (time_t)tTime.tv_sec; // some systems (e.g. openbsd) define tv_sec as long int instead of time_t
|
||||
tm tM;
|
||||
tzset();// localtime_r requires this
|
||||
|
||||
+12
-12
@@ -62,7 +62,7 @@ unsigned char* CString::strnchr(const unsigned char* src, unsigned char c, unsig
|
||||
*piCount = 0;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int CString::CaseCmp(const CString& s, CString::size_type uLen) const {
|
||||
@@ -104,7 +104,7 @@ bool CString::WildCmp(const CString& sWild, const CString& sString, CaseSensitiv
|
||||
|
||||
// Written by Jack Handy - jakkhandy@hotmail.com
|
||||
const char *wild = sWld.c_str(), *CString = sStr.c_str();
|
||||
const char *cp = NULL, *mp = NULL;
|
||||
const char *cp = nullptr, *mp = nullptr;
|
||||
|
||||
while ((*CString) && (*wild != '*')) {
|
||||
if ((*wild != *CString) && (*wild != '?')) {
|
||||
@@ -222,7 +222,7 @@ CString CString::Escape_n(EEscape eFrom, EEscape eTo) const {
|
||||
base = 16;
|
||||
}
|
||||
|
||||
char* endptr = NULL;
|
||||
char* endptr = nullptr;
|
||||
unsigned long int b = strtol((const char*) (pTmp +2 + (base == 16)), &endptr, base);
|
||||
|
||||
if ((*endptr == ';') && (b <= 255)) { // incase they do something like �
|
||||
@@ -1105,15 +1105,15 @@ bool CString::ToBool() const {
|
||||
!sTrimmed.Equals("n"));
|
||||
}
|
||||
|
||||
short CString::ToShort() const { return (short int)strtol(this->c_str(), (char**) NULL, 10); }
|
||||
unsigned short CString::ToUShort() const { return (unsigned short int)strtoul(this->c_str(), (char**) NULL, 10); }
|
||||
unsigned int CString::ToUInt() const { return (unsigned int)strtoul(this->c_str(), (char**) NULL, 10); }
|
||||
int CString::ToInt() const { return (int)strtol(this->c_str(), (char**) NULL, 10); }
|
||||
long CString::ToLong() const { return strtol(this->c_str(), (char**) NULL, 10); }
|
||||
unsigned long CString::ToULong() const { return strtoul(c_str(), NULL, 10); }
|
||||
unsigned long long CString::ToULongLong() const { return strtoull(c_str(), NULL, 10); }
|
||||
long long CString::ToLongLong() const { return strtoll(c_str(), NULL, 10); }
|
||||
double CString::ToDouble() const { return strtod(c_str(), NULL); }
|
||||
short CString::ToShort() const { return (short int)strtol(this->c_str(), (char**) nullptr, 10); }
|
||||
unsigned short CString::ToUShort() const { return (unsigned short int)strtoul(this->c_str(), (char**) nullptr, 10); }
|
||||
unsigned int CString::ToUInt() const { return (unsigned int)strtoul(this->c_str(), (char**) nullptr, 10); }
|
||||
int CString::ToInt() const { return (int)strtol(this->c_str(), (char**) nullptr, 10); }
|
||||
long CString::ToLong() const { return strtol(this->c_str(), (char**) nullptr, 10); }
|
||||
unsigned long CString::ToULong() const { return strtoul(c_str(), nullptr, 10); }
|
||||
unsigned long long CString::ToULongLong() const { return strtoull(c_str(), nullptr, 10); }
|
||||
long long CString::ToLongLong() const { return strtoll(c_str(), nullptr, 10); }
|
||||
double CString::ToDouble() const { return strtod(c_str(), nullptr); }
|
||||
|
||||
|
||||
bool CString::Trim(const CString& s) {
|
||||
|
||||
+23
-23
@@ -99,17 +99,17 @@ static inline int getopt_long(int argc, char * const argv[], const char *optstri
|
||||
#endif
|
||||
|
||||
static const struct option g_LongOpts[] = {
|
||||
{ "help", no_argument, 0, 'h' },
|
||||
{ "version", no_argument, 0, 'v' },
|
||||
{ "debug", no_argument, 0, 'D' },
|
||||
{ "foreground", no_argument, 0, 'f' },
|
||||
{ "no-color", no_argument, 0, 'n' },
|
||||
{ "allow-root", no_argument, 0, 'r' },
|
||||
{ "makeconf", no_argument, 0, 'c' },
|
||||
{ "makepass", no_argument, 0, 's' },
|
||||
{ "makepem", no_argument, 0, 'p' },
|
||||
{ "datadir", required_argument, 0, 'd' },
|
||||
{ 0, 0, 0, 0 }
|
||||
{ "help", no_argument, nullptr, 'h' },
|
||||
{ "version", no_argument, nullptr, 'v' },
|
||||
{ "debug", no_argument, nullptr, 'D' },
|
||||
{ "foreground", no_argument, nullptr, 'f' },
|
||||
{ "no-color", no_argument, nullptr, 'n' },
|
||||
{ "allow-root", no_argument, nullptr, 'r' },
|
||||
{ "makeconf", no_argument, nullptr, 'c' },
|
||||
{ "makepass", no_argument, nullptr, 's' },
|
||||
{ "makepem", no_argument, nullptr, 'p' },
|
||||
{ "datadir", required_argument, nullptr, 'd' },
|
||||
{ nullptr, 0, nullptr, 0 }
|
||||
};
|
||||
|
||||
static void GenerateHelp(const char *appname) {
|
||||
@@ -164,14 +164,14 @@ static void seedPRNG() {
|
||||
|
||||
// Try to find a seed which can't be as easily guessed as only time()
|
||||
|
||||
if (gettimeofday(&tv, NULL) == 0) {
|
||||
if (gettimeofday(&tv, nullptr) == 0) {
|
||||
seed = (unsigned int)tv.tv_sec;
|
||||
|
||||
// This is in [0:1e6], which means that roughly 20 bits are
|
||||
// actually used, let's try to shuffle the high bits.
|
||||
seed ^= uint32_t((tv.tv_usec << 10) | tv.tv_usec);
|
||||
} else
|
||||
seed = (unsigned int)time(NULL);
|
||||
seed = (unsigned int)time(nullptr);
|
||||
|
||||
seed ^= rand();
|
||||
seed ^= getpid();
|
||||
@@ -393,19 +393,19 @@ int main(int argc, char** argv) {
|
||||
sigemptyset(&sa.sa_mask);
|
||||
|
||||
sa.sa_handler = SIG_IGN;
|
||||
sigaction(SIGPIPE, &sa, (struct sigaction*) NULL);
|
||||
sigaction(SIGPIPE, &sa, (struct sigaction*) nullptr);
|
||||
|
||||
sa.sa_handler = signalHandler;
|
||||
sigaction(SIGHUP, &sa, (struct sigaction*) NULL);
|
||||
sigaction(SIGUSR1, &sa, (struct sigaction*) NULL);
|
||||
sigaction(SIGHUP, &sa, (struct sigaction*) nullptr);
|
||||
sigaction(SIGUSR1, &sa, (struct sigaction*) nullptr);
|
||||
|
||||
// Once this signal is caught, the signal handler is reset
|
||||
// to SIG_DFL. This avoids endless loop with signals.
|
||||
sa.sa_flags = SA_RESETHAND;
|
||||
sa.sa_handler = die;
|
||||
sigaction(SIGINT, &sa, (struct sigaction*) NULL);
|
||||
sigaction(SIGQUIT, &sa, (struct sigaction*) NULL);
|
||||
sigaction(SIGTERM, &sa, (struct sigaction*) NULL);
|
||||
sigaction(SIGINT, &sa, (struct sigaction*) nullptr);
|
||||
sigaction(SIGQUIT, &sa, (struct sigaction*) nullptr);
|
||||
sigaction(SIGTERM, &sa, (struct sigaction*) nullptr);
|
||||
|
||||
int iRet = 0;
|
||||
|
||||
@@ -422,10 +422,10 @@ int main(int argc, char** argv) {
|
||||
strdup(argv[0]),
|
||||
strdup("--datadir"),
|
||||
strdup(pZNC->GetZNCPath().c_str()),
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr
|
||||
};
|
||||
int pos = 3;
|
||||
if (CDebug::Debug())
|
||||
|
||||
+31
-31
@@ -48,12 +48,12 @@ CZNC::CZNC() {
|
||||
m_uBytesRead = 0;
|
||||
m_uBytesWritten = 0;
|
||||
m_uiMaxBufferSize = 500;
|
||||
m_pConnectQueueTimer = NULL;
|
||||
m_pConnectQueueTimer = nullptr;
|
||||
m_uiConnectPaused = 0;
|
||||
m_eConfigState = ECONFIG_NOTHING;
|
||||
m_TimeStarted = time(NULL);
|
||||
m_TimeStarted = time(nullptr);
|
||||
m_sConnectThrottle.SetTTL(30000);
|
||||
m_pLockFile = NULL;
|
||||
m_pLockFile = nullptr;
|
||||
m_bProtectWebSessions = true;
|
||||
m_bHideVersion = false;
|
||||
m_uDisabledSSLProtocols = Csock::EDP_SSL;
|
||||
@@ -80,7 +80,7 @@ CZNC::~CZNC() {
|
||||
a->second->SetBeingDeleted(true);
|
||||
}
|
||||
|
||||
m_pConnectQueueTimer = NULL;
|
||||
m_pConnectQueueTimer = nullptr;
|
||||
// This deletes m_pConnectQueueTimer
|
||||
m_Manager.Cleanup();
|
||||
DeleteUsers();
|
||||
@@ -141,7 +141,7 @@ CString CZNC::GetCompileOptionsString() {
|
||||
}
|
||||
|
||||
CString CZNC::GetUptime() const {
|
||||
time_t now = time(NULL);
|
||||
time_t now = time(nullptr);
|
||||
return CString::ToTimeStr(now - TimeStarted());
|
||||
}
|
||||
|
||||
@@ -235,12 +235,12 @@ CFile* CZNC::InitPidFile() {
|
||||
return new CFile(sFile);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool CZNC::WritePidFile(int iPid) {
|
||||
CFile* File = InitPidFile();
|
||||
if (File == NULL)
|
||||
if (File == nullptr)
|
||||
return false;
|
||||
|
||||
CUtils::PrintAction("Writing pid file [" + File->GetLongName() + "]");
|
||||
@@ -259,7 +259,7 @@ bool CZNC::WritePidFile(int iPid) {
|
||||
|
||||
bool CZNC::DeletePidFile() {
|
||||
CFile* File = InitPidFile();
|
||||
if (File == NULL)
|
||||
if (File == nullptr)
|
||||
return false;
|
||||
|
||||
CUtils::PrintAction("Deleting pid file [" + File->GetLongName() + "]");
|
||||
@@ -1015,7 +1015,7 @@ bool CZNC::DoRehash(CString& sError)
|
||||
if (!pOldMod) {
|
||||
CUtils::PrintAction("Loading global module [" + sModName + "]");
|
||||
|
||||
bool bModRet = GetModules().LoadModule(sModName, sArgs, CModInfo::GlobalModule, NULL, NULL, sModRet);
|
||||
bool bModRet = GetModules().LoadModule(sModName, sArgs, CModInfo::GlobalModule, nullptr, nullptr, sModRet);
|
||||
|
||||
CUtils::PrintStatus(bModRet, sModRet);
|
||||
if (!bModRet) {
|
||||
@@ -1025,7 +1025,7 @@ bool CZNC::DoRehash(CString& sError)
|
||||
} else if (pOldMod->GetArgs() != sArgs) {
|
||||
CUtils::PrintAction("Reloading global module [" + sModName + "]");
|
||||
|
||||
bool bModRet = GetModules().ReloadModule(sModName, sArgs, NULL, NULL, sModRet);
|
||||
bool bModRet = GetModules().ReloadModule(sModName, sArgs, nullptr, nullptr, sModRet);
|
||||
|
||||
CUtils::PrintStatus(bModRet, sModRet);
|
||||
if (!bModRet) {
|
||||
@@ -1047,7 +1047,7 @@ bool CZNC::DoRehash(CString& sError)
|
||||
CUtils::PrintAction("Loading global Module [identfile]");
|
||||
|
||||
CString sModRet;
|
||||
bool bModRet = GetModules().LoadModule("identfile", "", CModInfo::GlobalModule, NULL, NULL, sModRet);
|
||||
bool bModRet = GetModules().LoadModule("identfile", "", CModInfo::GlobalModule, nullptr, nullptr, sModRet);
|
||||
|
||||
CUtils::PrintStatus(bModRet, sModRet);
|
||||
if (!bModRet) {
|
||||
@@ -1184,7 +1184,7 @@ bool CZNC::DoRehash(CString& sError)
|
||||
for (subIt = subConf.begin(); subIt != subConf.end(); ++subIt) {
|
||||
const CString& sUserName = subIt->first;
|
||||
CConfig* pSubConf = subIt->second.m_pSubConfig;
|
||||
CUser* pRealUser = NULL;
|
||||
CUser* pRealUser = nullptr;
|
||||
|
||||
CUtils::PrintMessage("Loading user [" + sUserName + "]");
|
||||
|
||||
@@ -1209,7 +1209,7 @@ bool CZNC::DoRehash(CString& sError)
|
||||
if (!pUser->ParseConfig(pSubConf, sError)) {
|
||||
CUtils::PrintError(sError);
|
||||
delete pUser;
|
||||
pUser = NULL;
|
||||
pUser = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1230,7 +1230,7 @@ bool CZNC::DoRehash(CString& sError)
|
||||
}
|
||||
pUser->SetBeingDeleted(true);
|
||||
delete pUser;
|
||||
pUser = NULL;
|
||||
pUser = nullptr;
|
||||
} else if (!AddUser(pUser, sErr)) {
|
||||
sError = "Invalid user [" + pUser->GetUserName() + "] " + sErr;
|
||||
}
|
||||
@@ -1240,13 +1240,13 @@ bool CZNC::DoRehash(CString& sError)
|
||||
if (pUser) {
|
||||
pUser->SetBeingDeleted(true);
|
||||
delete pUser;
|
||||
pUser = NULL;
|
||||
pUser = nullptr;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
pUser = NULL;
|
||||
pRealUser = NULL;
|
||||
pUser = nullptr;
|
||||
pRealUser = nullptr;
|
||||
}
|
||||
|
||||
if (!config.empty()) {
|
||||
@@ -1385,10 +1385,10 @@ void CZNC::Broadcast(const CString& sMessage, bool bAdminOnly,
|
||||
CString sMsg = sMessage;
|
||||
|
||||
bool bContinue = false;
|
||||
USERMODULECALL(OnBroadcast(sMsg), a->second, NULL, &bContinue);
|
||||
USERMODULECALL(OnBroadcast(sMsg), a->second, nullptr, &bContinue);
|
||||
if (bContinue) continue;
|
||||
|
||||
a->second->PutStatusNotice("*** " + sMsg, NULL, pSkipClient);
|
||||
a->second->PutStatusNotice("*** " + sMsg, nullptr, pSkipClient);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1400,7 +1400,7 @@ CModule* CZNC::FindModule(const CString& sModName, const CString& sUsername) {
|
||||
|
||||
CUser* pUser = FindUser(sUsername);
|
||||
|
||||
return (!pUser) ? NULL : pUser->GetModules().FindModule(sModName);
|
||||
return (!pUser) ? nullptr : pUser->GetModules().FindModule(sModName);
|
||||
}
|
||||
|
||||
CModule* CZNC::FindModule(const CString& sModName, CUser* pUser) {
|
||||
@@ -1461,7 +1461,7 @@ bool CZNC::UpdateModule(const CString &sModule) {
|
||||
|
||||
// Reload the global module
|
||||
if (bGlobal) {
|
||||
if (!GetModules().LoadModule(sModule, sGlobalArgs, CModInfo::GlobalModule, NULL, NULL, sErr)) {
|
||||
if (!GetModules().LoadModule(sModule, sGlobalArgs, CModInfo::GlobalModule, nullptr, nullptr, sErr)) {
|
||||
DEBUG("Failed to reload [" << sModule << "] globally [" << sErr << "]");
|
||||
bError = true;
|
||||
}
|
||||
@@ -1472,7 +1472,7 @@ bool CZNC::UpdateModule(const CString &sModule) {
|
||||
CUser *pUser = musIt->first;
|
||||
CString& sArgs = musIt->second;
|
||||
|
||||
if (!pUser->GetModules().LoadModule(sModule, sArgs, CModInfo::UserModule, pUser, NULL, sErr)) {
|
||||
if (!pUser->GetModules().LoadModule(sModule, sArgs, CModInfo::UserModule, pUser, nullptr, sErr)) {
|
||||
DEBUG("Failed to reload [" << sModule << "] for ["
|
||||
<< pUser->GetUserName() << "] [" << sErr << "]");
|
||||
bError = true;
|
||||
@@ -1502,7 +1502,7 @@ CUser* CZNC::FindUser(const CString& sUsername) {
|
||||
return it->second;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool CZNC::DeleteUser(const CString& sUsername) {
|
||||
@@ -1517,7 +1517,7 @@ bool CZNC::DeleteUser(const CString& sUsername) {
|
||||
}
|
||||
|
||||
bool CZNC::AddUser(CUser* pUser, CString& sErrorRet) {
|
||||
if (FindUser(pUser->GetUserName()) != NULL) {
|
||||
if (FindUser(pUser->GetUserName()) != nullptr) {
|
||||
sErrorRet = "User already exists";
|
||||
DEBUG("User [" << pUser->GetUserName() << "] - already exists");
|
||||
return false;
|
||||
@@ -1550,7 +1550,7 @@ CListener* CZNC::FindListener(u_short uPort, const CString& sBindHost, EAddrType
|
||||
continue;
|
||||
return *it;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool CZNC::AddListener(const CString& sLine, CString& sError) {
|
||||
@@ -1769,7 +1769,7 @@ bool CZNC::DelListener(CListener* pListener) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static CZNC* s_pZNC = NULL;
|
||||
static CZNC* s_pZNC = nullptr;
|
||||
|
||||
void CZNC::CreateInstance() {
|
||||
if (s_pZNC)
|
||||
@@ -1784,7 +1784,7 @@ CZNC& CZNC::Get() {
|
||||
|
||||
void CZNC::DestroyInstance() {
|
||||
delete s_pZNC;
|
||||
s_pZNC = NULL;
|
||||
s_pZNC = nullptr;
|
||||
}
|
||||
|
||||
CZNC::TrafficStatsMap CZNC::GetTrafficStats(TrafficStatsPair &Users,
|
||||
@@ -1804,7 +1804,7 @@ CZNC::TrafficStatsMap CZNC::GetTrafficStats(TrafficStatsPair &Users,
|
||||
}
|
||||
|
||||
for (CSockManager::const_iterator it = m_Manager.begin(); it != m_Manager.end(); ++it) {
|
||||
CUser *pUser = NULL;
|
||||
CUser *pUser = nullptr;
|
||||
if ((*it)->GetSockName().Left(5) == "IRC::") {
|
||||
pUser = ((CIRCSock *) *it)->GetNetwork()->GetUser();
|
||||
} else if ((*it)->GetSockName().Left(5) == "USR::") {
|
||||
@@ -1913,7 +1913,7 @@ void CZNC::SetConnectDelay(unsigned int i) {
|
||||
// Don't hammer server with our failed connects
|
||||
i = 1;
|
||||
}
|
||||
if (m_uiConnectDelay != i && m_pConnectQueueTimer != NULL) {
|
||||
if (m_uiConnectDelay != i && m_pConnectQueueTimer != nullptr) {
|
||||
m_pConnectQueueTimer->Start(i);
|
||||
}
|
||||
m_uiConnectDelay = i;
|
||||
@@ -1930,7 +1930,7 @@ void CZNC::DisableConnectQueue() {
|
||||
if (m_pConnectQueueTimer) {
|
||||
// This will kill the cron
|
||||
m_pConnectQueueTimer->Stop();
|
||||
m_pConnectQueueTimer = NULL;
|
||||
m_pConnectQueueTimer = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1967,7 +1967,7 @@ void CZNC::AddNetworkToQueue(CIRCNetwork *pNetwork) {
|
||||
|
||||
void CZNC::LeakConnectQueueTimer(CConnectQueueTimer *pTimer) {
|
||||
if (m_pConnectQueueTimer == pTimer)
|
||||
m_pConnectQueueTimer = NULL;
|
||||
m_pConnectQueueTimer = nullptr;
|
||||
}
|
||||
|
||||
bool CZNC::WaitForChildLock() {
|
||||
|
||||
Reference in New Issue
Block a user