Added CTCPReply config option and removed VersionReply

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@394 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
prozacx
2005-06-28 07:25:28 +00:00
parent dbfaa3850a
commit 18b6b2e754
5 changed files with 28 additions and 14 deletions
+20 -6
View File
@@ -621,12 +621,7 @@ bool CIRCSock::OnCTCPReply(const CString& sNickMask, CString& sMessage) {
bool CIRCSock::OnPrivCTCP(const CString& sNickMask, CString& sMessage) {
MODULECALL(OnPrivCTCP(sNickMask, sMessage));
if (sMessage.CaseCmp("VERSION") == 0) {
if (!IsUserAttached()) {
CString sVersionReply = m_pUser->GetVersionReply();
PutServ("NOTICE " + CNick(sNickMask).GetNick() + " :\001VERSION " + sVersionReply + "\001");
}
} else if (strncasecmp(sMessage.c_str(), "DCC ", 4) == 0 && m_pUser && m_pUser->BounceDCCs()) {
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);
@@ -674,6 +669,25 @@ bool CIRCSock::OnPrivCTCP(const CString& sNickMask, CString& sMessage) {
}
return true;
} else {
if (!IsUserAttached()) {
const MCString& mssCTCPReplies = m_pUser->GetCTCPReplies();
MCString::const_iterator it = mssCTCPReplies.find(sMessage.AsUpper());
CString sQuery = sMessage.Token(0).AsUpper();
CString sReply;
if (it != mssCTCPReplies.end()) {
sReply = it->second;
}
if (sReply.empty() && sQuery == "VERSION") {
sReply = "ZNC by prozac - http://znc.sourceforge.net";
}
if (!sReply.empty()) {
PutServ("NOTICE " + CNick(sNickMask).GetNick() + " :\001" + sQuery + " " + sReply + "\001");
}
}
}
return false;
+2 -2
View File
@@ -461,7 +461,7 @@ void CUser::SetDefaultChanModes(const CString& s) { m_sDefaultChanModes = s; }
void CUser::SetIRCNick(const CNick& n) { m_IRCNick = n; }
void CUser::SetIRCServer(const CString& s) { m_sIRCServer = s; }
void CUser::SetQuitMsg(const CString& s) { m_sQuitMsg = s; }
void CUser::SetVersionReply(const CString& s) { m_sVersionReply = s; }
void CUser::AddCTCPReply(const CString& sCTCP, const CString& sReply) { m_mssCTCPReplies[sCTCP.AsUpper()] = sReply; }
void CUser::SetBufferCount(unsigned int u) { m_uBufferCount = u; }
void CUser::SetKeepBuffer(bool b) { m_bKeepBuffer = b; }
@@ -539,7 +539,7 @@ const vector<CServer*>& CUser::GetServers() const { return m_vServers; }
const CNick& CUser::GetIRCNick() const { return m_IRCNick; }
const CString& CUser::GetIRCServer() const { return m_sIRCServer; }
CString CUser::GetQuitMsg() const { return (!m_sQuitMsg.empty()) ? m_sQuitMsg : "ZNC by prozac - http://znc.sourceforge.net"; }
CString CUser::GetVersionReply() const { return (!m_sVersionReply.empty()) ? m_sVersionReply : "ZNC by prozac - http://znc.sourceforge.net"; }
const MCString& CUser::GetCTCPReplies() const { return m_mssCTCPReplies; }
unsigned int CUser::GetBufferCount() const { return m_uBufferCount; }
bool CUser::KeepBuffer() const { return m_bKeepBuffer; }
// !Getters
+3 -3
View File
@@ -80,7 +80,7 @@ public:
void SetIRCNick(const CNick& n);
void SetIRCServer(const CString& s);
void SetQuitMsg(const CString& s);
void SetVersionReply(const CString& s);
void AddCTCPReply(const CString& sCTCP, const CString& sReply);
void SetBufferCount(unsigned int u);
void SetKeepBuffer(bool b);
// !Setters
@@ -118,7 +118,7 @@ public:
const CNick& GetIRCNick() const;
const CString& GetIRCServer() const;
CString GetQuitMsg() const;
CString GetVersionReply() const;
const MCString& GetCTCPReplies() const;
unsigned int GetBufferCount() const;
bool KeepBuffer() const;
// !Getters
@@ -140,7 +140,7 @@ protected:
CNick m_IRCNick;
CString m_sIRCServer;
CString m_sQuitMsg;
CString m_sVersionReply;
MCString m_mssCTCPReplies;
// Paths
CString m_sUserPath;
+1 -1
View File
@@ -46,7 +46,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
CTCPReply = VERSION ZNC by prozac - http://znc.sourceforge.net
ChanModes = +stn
KeepNick = true
+2 -2
View File
@@ -676,8 +676,8 @@ bool CZNC::ParseConfig(const CString& sConfig) {
} else if (sName.CaseCmp("Nick") == 0) {
pUser->SetNick(sValue);
continue;
} else if (sName.CaseCmp("VersionReply") == 0) {
pUser->SetVersionReply(sValue);
} else if (sName.CaseCmp("CTCPReply") == 0) {
pUser->AddCTCPReply(sValue.Token(0), sValue.Token(1, true));
continue;
} else if (sName.CaseCmp("QuitMsg") == 0) {
pUser->SetQuitMsg(sValue);