From 1c72af7d2d9737b65d87b596046070859e86bb3c Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 8 Sep 2014 00:23:28 +0200 Subject: [PATCH] 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... --- src/znc.cpp | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/znc.cpp b/src/znc.cpp index 8e348751..813ece32 100644 --- a/src/znc.cpp +++ b/src/znc.cpp @@ -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"); - vsLines.push_back("\t\t"); - 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"); + vsLines.push_back("\t\t"); + } } vsLines.push_back("\t");