Added VersionReply config option

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@167 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
prozacx
2005-04-23 16:30:57 +00:00
parent 77798b286a
commit b69a6419ab
5 changed files with 21 additions and 2 deletions

View File

@@ -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);

View File

@@ -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<CChan*>& 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

3
User.h
View File

@@ -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;

View File

@@ -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

View File

@@ -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;