diff --git a/IRCSock.cpp b/IRCSock.cpp index 1609497c..fe248352 100644 --- a/IRCSock.cpp +++ b/IRCSock.cpp @@ -613,8 +613,18 @@ bool CIRCSock::OnPrivCTCP(const string& sNickMask, string& sMessage) { } #endif - // DCC CHAT chat 2453612361 44592 - if (strncasecmp(sMessage.c_str(), "DCC ", 4) == 0) { + if (strcasecmp(sMessage.c_str(), "VERSION") == 0) { + if (!IsUserAttached()) { + string sVersionReply = m_pUser->GetVersionReply(); + + if (sVersionReply.empty()) { + sVersionReply = "ZNC by prozac - http://znc.sourceforge.net"; + } + + PutServ("NOTICE " + CNick(sNickMask).GetNick() + " :\001VERSION " + sVersionReply + "\001"); + } + } else if (strncasecmp(sMessage.c_str(), "DCC ", 4) == 0) { + // DCC CHAT chat 2453612361 44592 string sType = CUtils::Token(sMessage, 1); string sFile = CUtils::Token(sMessage, 2); unsigned long uLongIP = strtoul(CUtils::Token(sMessage, 3).c_str(), NULL, 10); diff --git a/User.cpp b/User.cpp index cf71fdb4..27de9511 100644 --- a/User.cpp +++ b/User.cpp @@ -378,6 +378,7 @@ void CUser::SetDefaultChanModes(const string& s) { m_sDefaultChanModes = s; } void CUser::SetIRCNick(const CNick& n) { m_IRCNick = n; } void CUser::SetIRCServer(const string& s) { m_sIRCServer = s; } void CUser::SetQuitMsg(const string& s) { m_sQuitMsg = s; } +void CUser::SetVersionReply(const string& s) { m_sVersionReply = s; } bool CUser::SetStatusPrefix(const string& s) { if ((!s.empty()) && (s.length() < 6) && (s.find(' ') == string::npos)) { @@ -414,4 +415,5 @@ const vector& CUser::GetChans() const { return m_vChans; } const CNick& CUser::GetIRCNick() const { return m_IRCNick; } const string& CUser::GetIRCServer() const { return m_sIRCServer; } const string& CUser::GetQuitMsg() const { return m_sQuitMsg; } +const string& CUser::GetVersionReply() const { return m_sVersionReply; } // !Getters diff --git a/User.h b/User.h index e0fe1ccd..254bb600 100644 --- a/User.h +++ b/User.h @@ -70,6 +70,7 @@ public: void SetIRCNick(const CNick& n); void SetIRCServer(const string& s); void SetQuitMsg(const string& s); + void SetVersionReply(const string& s); // !Setters // Getters @@ -101,6 +102,7 @@ public: const CNick& GetIRCNick() const; const string& GetIRCServer() const; const string& GetQuitMsg() const; + const string& GetVersionReply() const; // !Getters private: protected: @@ -118,6 +120,7 @@ protected: CNick m_IRCNick; string m_sIRCServer; string m_sQuitMsg; + string m_sVersionReply; bool m_bPassHashed; bool m_bUseClientIP; diff --git a/znc.conf b/znc.conf index fe734964..d3dd3899 100644 --- a/znc.conf +++ b/znc.conf @@ -37,6 +37,7 @@ StatusPrefix = * RealName = Got ZNC? #VHost = uncomment.and.put.your.vhost.here.com QuitMsg = ZNC by prozac - http://znc.sourceforge.net + VersionReply = ZNC by prozac - http://znc.sourceforge.net ChanModes = +stn KeepNick = true diff --git a/znc.cpp b/znc.cpp index a7fb1cf2..2e19d200 100644 --- a/znc.cpp +++ b/znc.cpp @@ -370,6 +370,9 @@ bool CZNC::ParseConfig(const string& sConfigFile) { if (strcasecmp(sName.c_str(), "Nick") == 0) { pUser->SetNick(sValue); continue; + } else if (strcasecmp(sName.c_str(), "VersionReply") == 0) { + pUser->SetVersionReply(sValue); + continue; } else if (strcasecmp(sName.c_str(), "QuitMsg") == 0) { pUser->SetQuitMsg(sValue); continue;