mirror of
https://github.com/znc/znc.git
synced 2026-07-31 22:13:20 +02:00
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:
+10
-13
@@ -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>");
|
||||
|
||||
Reference in New Issue
Block a user