diff --git a/IRCSock.cpp b/IRCSock.cpp index d0e870b7..eeb1ba87 100644 --- a/IRCSock.cpp +++ b/IRCSock.cpp @@ -626,7 +626,7 @@ bool CIRCSock::OnPrivCTCP(const CString& sNickMask, CString& sMessage) { CString sVersionReply = m_pUser->GetVersionReply(); PutServ("NOTICE " + CNick(sNickMask).GetNick() + " :\001VERSION " + sVersionReply + "\001"); } - } else if (strncasecmp(sMessage.c_str(), "DCC ", 4) == 0) { + } else if (strncasecmp(sMessage.c_str(), "DCC ", 4) == 0 && m_pUser && m_pUser->BounceDCCs()) { // DCC CHAT chat 2453612361 44592 CString sType = sMessage.Token(1); CString sFile = sMessage.Token(2); diff --git a/User.cpp b/User.cpp index 6d162769..f09bb679 100644 --- a/User.cpp +++ b/User.cpp @@ -20,6 +20,7 @@ CUser::CUser(const CString& sUserName, CZNC* pZNC) { #ifdef _MODULES m_pModules = new CModules(pZNC); #endif + m_bBounceDCCs = true; m_bPassHashed = false; m_bUseClientIP = false; m_bKeepNick = false; @@ -452,6 +453,7 @@ void CUser::SetIdent(const CString& s) { m_sIdent = s; } void CUser::SetRealName(const CString& s) { m_sRealName = s; } void CUser::SetVHost(const CString& s) { m_sVHost = s; } void CUser::SetPass(const CString& s, bool bHashed) { m_sPass = s; m_bPassHashed = bHashed; } +void CUser::SetBounceDCCs(bool b) { m_bBounceDCCs = b; } void CUser::SetUseClientIP(bool b) { m_bUseClientIP = b; } void CUser::SetKeepNick(bool b) { m_bKeepNick = b; } void CUser::SetDenyLoadMod(bool b) { m_bDenyLoadMod = b; } @@ -529,6 +531,7 @@ CString CUser::GetPemLocation() const { return m_pZNC->GetPemLocation(); } bool CUser::UseClientIP() const { return m_bUseClientIP; } bool CUser::GetKeepNick() const { return m_bKeepNick; } bool CUser::DenyLoadMod() const { return m_bDenyLoadMod; } +bool CUser::BounceDCCs() const { return m_bBounceDCCs; } const CString& CUser::GetStatusPrefix() const { return m_sStatusPrefix; } const CString& CUser::GetDefaultChanModes() const { return m_sDefaultChanModes; } const vector& CUser::GetChans() const { return m_vChans; } diff --git a/User.h b/User.h index 35233d0c..504a585c 100644 --- a/User.h +++ b/User.h @@ -71,6 +71,7 @@ public: void SetRealName(const CString& s); void SetVHost(const CString& s); void SetPass(const CString& s, bool bHashed); + void SetBounceDCCs(bool b); void SetUseClientIP(bool b); void SetKeepNick(bool b); void SetDenyLoadMod(bool b); @@ -109,6 +110,7 @@ public: bool UseClientIP() const; bool GetKeepNick() const; bool DenyLoadMod() const; + bool BounceDCCs() const; const CString& GetStatusPrefix() const; const CString& GetDefaultChanModes() const; const vector& GetChans() const; @@ -145,6 +147,7 @@ protected: CString m_sDLPath; // !Paths + bool m_bBounceDCCs; bool m_bPassHashed; bool m_bUseClientIP; bool m_bKeepNick; diff --git a/UserSock.cpp b/UserSock.cpp index da8b3007..2982a0ce 100644 --- a/UserSock.cpp +++ b/UserSock.cpp @@ -200,7 +200,7 @@ void CUserSock::ReadLine(const CString& sData) { sCTCP.LeftChomp(); sCTCP.RightChomp(); - if (strncasecmp(sCTCP.c_str(), "DCC ", 4) == 0) { + if (strncasecmp(sCTCP.c_str(), "DCC ", 4) == 0 && m_pUser && m_pUser->BounceDCCs()) { CString sType = sCTCP.Token(1); CString sFile = sCTCP.Token(2); unsigned long uLongIP = strtoul(sCTCP.Token(3).c_str(), NULL, 10); diff --git a/znc.cpp b/znc.cpp index 27b8b0bd..18a6ceb4 100644 --- a/znc.cpp +++ b/znc.cpp @@ -697,6 +697,9 @@ bool CZNC::ParseConfig(const CString& sConfig) { pUser->SetPass(sValue, false); } + continue; + } else if (sName.CaseCmp("BounceDCCs") == 0) { + pUser->SetBounceDCCs(sValue.CaseCmp("true") == 0); continue; } else if (sName.CaseCmp("AutoCycle") == 0) { bAutoCycle = (sValue.CaseCmp("true") == 0);