From: <ps...@us...> - 2009-11-29 15:17:55
|
Revision: 1670 http://znc.svn.sourceforge.net/znc/?rev=1670&view=rev Author: psychon Date: 2009-11-29 15:17:39 +0000 (Sun, 29 Nov 2009) Log Message: ----------- ISpoofFormat: Go through ExpandString() ISpoofFormat now can be used with e.g. %user% which allows some kind of poor-man's DenySetIdent (force ident to be user name). For backward compatibility, if ExpandString() doesn't change the string we just replace all "%" with the user's ident. Thanks to DarthGandalf for the idea and the patch. Modified Paths: -------------- trunk/znc.cpp Modified: trunk/znc.cpp =================================================================== --- trunk/znc.cpp 2009-11-28 18:53:20 UTC (rev 1669) +++ trunk/znc.cpp 2009-11-29 15:17:39 UTC (rev 1670) @@ -287,7 +287,13 @@ return false; } - CString sData = m_sISpoofFormat.Token(0, false, "%") + pUser->GetIdent() + m_sISpoofFormat.Token(1, true, "%"); + CString sData = pUser->ExpandString(m_sISpoofFormat); + + // If the format doesn't contain anything expandable, we'll + // assume this is an "old"-style format string. + if (sData == m_sISpoofFormat) { + sData.Replace("%", pUser->GetIdent()); + } m_pISpoofLockFile->Write(sData + "\n"); } return true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |