mirror of
https://github.com/znc/znc.git
synced 2026-04-30 18:42:25 +02:00
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. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1670 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
8
znc.cpp
8
znc.cpp
@@ -287,7 +287,13 @@ bool CZNC::WriteISpoof(CUser* pUser) {
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user