makeconf: change the channel input loop to a one-liner

The "would you like to add a channel?" ... "would you like to add
another channel?" loop is very verbose and slow to use. This proposal
makes it a simple one-liner where the user can enter a bunch of chans
using any combination of space/comma/semi-colon as a separator, or
just hit enter to proceed without channels...
This commit is contained in:
J-P Nurmi
2014-09-08 00:23:28 +02:00
parent b1451a28c4
commit 1c72af7d2d
+10 -13
View File
@@ -731,20 +731,17 @@ bool CZNC::WriteNewConfig(const CString& sConfigFile) {
vsLines.push_back("");
CUtils::PrintMessage("");
CUtils::PrintMessage("-- Channels --");
CUtils::PrintMessage("");
CString sArg = "a";
CString sPost = " for ZNC to automatically join?";
bool bDefault = true;
while (CUtils::GetBoolInput("Would you like to add " + sArg + " channel" + sPost, bDefault)) {
while (!CUtils::GetInput("Channel name", sAnswer)) ;
vsLines.push_back("\t\t<Chan " + sAnswer + ">");
vsLines.push_back("\t\t</Chan>");
sArg = "another";
sPost = "?";
bDefault = false;
CString sChans;
if (CUtils::GetInput("Initial channels", sChans)) {
VCString vsChans;
sChans.Replace(",", " ");
sChans.Replace(";", " ");
sChans.Split(" ", vsChans, false, "", "", true, true);
for (const CString& sChan : vsChans) {
vsLines.push_back("\t\t<Chan " + sChan + ">");
vsLines.push_back("\t\t</Chan>");
}
}
vsLines.push_back("\t</Network>");