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:
kroimon
2008-10-10 15:45:20 +00:00
parent f6efc88868
commit 88a993a63a
+7 -7
View File
@@ -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) {