mirror of
https://github.com/znc/znc.git
synced 2026-07-04 17:01:23 +02:00
Add recognition for 'y' and 'n' to CUtils::GetBoolInput.
Only 'yes'/'no' was possible before. This commit also fixes a possible stack overflow because of recursion. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1244 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
@@ -258,15 +258,15 @@ bool CUtils::GetBoolInput(const CString& sPrompt, bool *pbDefault) {
|
||||
sDefault = (*pbDefault) ? "yes" : "no";
|
||||
}
|
||||
|
||||
GetInput(sPrompt, sRet, sDefault, "yes/no");
|
||||
while (true) {
|
||||
GetInput(sPrompt, sRet, sDefault, "yes/no");
|
||||
|
||||
if (sRet.Equals("yes")) {
|
||||
return true;
|
||||
} else if (sRet.Equals("no")) {
|
||||
return false;
|
||||
if (sRet.Equals("y") || sRet.Equals("yes")) {
|
||||
return true;
|
||||
} else if (sRet.Equals("n") || sRet.Equals("no")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return GetBoolInput(sPrompt, pbDefault);
|
||||
}
|
||||
|
||||
bool CUtils::GetNumInput(const CString& sPrompt, unsigned int& uRet, unsigned int uMin, unsigned int uMax, unsigned int uDefault) {
|
||||
|
||||
Reference in New Issue
Block a user