From d260d6888f180450bbbfb0a95a3ab1f94ad3ad4a Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sun, 7 Sep 2014 14:19:56 +0200 Subject: [PATCH 1/9] Utils: don't capitalize password --- src/Utils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Utils.cpp b/src/Utils.cpp index 33c83de1..24769f8f 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -156,8 +156,8 @@ CString CUtils::GetSaltedHashPass(CString& sSalt) { sSalt = GetSalt(); while (true) { - CString pass1 = CUtils::GetPass("Enter Password"); - CString pass2 = CUtils::GetPass("Confirm Password"); + CString pass1 = CUtils::GetPass("Enter password"); + CString pass2 = CUtils::GetPass("Confirm password"); if (!pass1.Equals(pass2, true)) { CUtils::PrintError("The supplied passwords did not match"); From b4c0522e7819629500f2a0bfdf8836bc8550ac2b Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sun, 7 Sep 2014 14:20:08 +0200 Subject: [PATCH 2/9] Utils: fix indentation of bold messages --- src/Utils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Utils.cpp b/src/Utils.cpp index 24769f8f..57c1486a 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -302,7 +302,7 @@ void CUtils::PrintPrompt(const CString& sMessage) { void CUtils::PrintMessage(const CString& sMessage, bool bStrong) { if (CDebug::StdoutIsTTY()) { if (bStrong) - fprintf(stdout, BOLD BLU "[" YEL " ** " BLU "]" DFL BOLD "%s" NORM "\n", + fprintf(stdout, BOLD BLU "[" YEL " ** " BLU "]" DFL BOLD " %s" NORM "\n", sMessage.c_str()); else fprintf(stdout, BOLD BLU "[" YEL " ** " BLU "]" DFL NORM " %s\n", From 396bdb1ebafaf88ec1c72d89b174d3d1c2f23352 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sun, 7 Sep 2014 16:30:44 +0200 Subject: [PATCH 3/9] Utils: improve password prompt Check if the password is empty before asking to confirm it. --- src/Utils.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Utils.cpp b/src/Utils.cpp index 57c1486a..580a725a 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -156,13 +156,15 @@ CString CUtils::GetSaltedHashPass(CString& sSalt) { sSalt = GetSalt(); while (true) { - CString pass1 = CUtils::GetPass("Enter password"); + CString pass1; + do { + pass1 = CUtils::GetPass("Enter password"); + } while (pass1.empty()); + CString pass2 = CUtils::GetPass("Confirm password"); if (!pass1.Equals(pass2, true)) { CUtils::PrintError("The supplied passwords did not match"); - } else if (pass1.empty()) { - CUtils::PrintError("You can not use an empty password"); } else { // Construct the salted pass return SaltedSHA256Hash(pass1, sSalt); From 139282fe3834c7bbcc3f031051ed4907b0d3a189 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sun, 7 Sep 2014 14:28:56 +0200 Subject: [PATCH 4/9] makeconf: kill buffer and chan mode questions Use webadmin/controlpanel to configure buffers and default chan modes --- src/znc.cpp | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/src/znc.cpp b/src/znc.cpp index 171689fc..5e19cf20 100644 --- a/src/znc.cpp +++ b/src/znc.cpp @@ -692,29 +692,6 @@ bool CZNC::WriteNewConfig(const CString& sConfigFile) { if (!sAnswer.empty()) { vsLines.push_back("\tBindHost = " + sAnswer); } - // todo: Possibly add motd - - unsigned int uBufferCount = 0; - - CUtils::GetNumInput("Number of lines to buffer per channel or query", uBufferCount, 0, ~0, 50); - if (uBufferCount) { - vsLines.push_back("\tBuffer = " + CString(uBufferCount)); - } - if (CUtils::GetBoolInput("Would you like to clear channel buffers after replay?", true)) { - vsLines.push_back("\tAutoClearChanBuffer = true"); - } else { - vsLines.push_back("\tAutoClearChanBuffer = false"); - } - if (CUtils::GetBoolInput("Would you like to clear query buffers after replay?", true)) { - vsLines.push_back("\tAutoClearQueryBuffer = true"); - } else { - vsLines.push_back("\tAutoClearQueryBuffer = false"); - } - - CUtils::GetInput("Default channel modes", sAnswer, "+stn"); - if (!sAnswer.empty()) { - vsLines.push_back("\tChanModes = " + sAnswer); - } set ssUserMods; GetModules().GetDefaultMods(ssUserMods, CModInfo::UserModule); From 69e38cafe2a2bb71145aabbebaf12ec60b45c303 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sun, 7 Sep 2014 14:29:52 +0200 Subject: [PATCH 5/9] makeconf: use username instead of nick as ident Username and ident are more likely to match. --- src/znc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/znc.cpp b/src/znc.cpp index 5e19cf20..1f26681d 100644 --- a/src/znc.cpp +++ b/src/znc.cpp @@ -684,7 +684,7 @@ bool CZNC::WriteNewConfig(const CString& sConfigFile) { if (!sAnswer.empty()) { vsLines.push_back("\tAltNick = " + sAnswer); } - CUtils::GetInput("Ident", sAnswer, sNick); + CUtils::GetInput("Ident", sAnswer, sUser); vsLines.push_back("\tIdent = " + sAnswer); CUtils::GetInput("Real Name", sAnswer, "Got ZNC?"); vsLines.push_back("\tRealName = " + sAnswer); From a489304a0e7700ed9cc4e97968910d4f90384f3c Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sun, 7 Sep 2014 14:30:55 +0200 Subject: [PATCH 6/9] makeconf: offer SSL by default if the port is 6697 --- src/znc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/znc.cpp b/src/znc.cpp index 1f26681d..3280ddff 100644 --- a/src/znc.cpp +++ b/src/znc.cpp @@ -740,7 +740,7 @@ bool CZNC::WriteNewConfig(const CString& sConfigFile) { CUtils::GetInput("[" + sHost + "] Password (probably empty)", sPass); #ifdef HAVE_LIBSSL - bSSL = CUtils::GetBoolInput("Does this server use SSL?", false); + bSSL = CUtils::GetBoolInput("Does this server use SSL?", uServerPort == 6697); #endif vsLines.push_back("\t\tServer = " + sHost + ((bSSL) ? " +" : " ") + CString(uServerPort) + " " + sPass); From 6ec56778e5f8137630655901b9b9b3c95af57d5d Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sun, 7 Sep 2014 16:13:01 +0200 Subject: [PATCH 7/9] makeconf: just warn if the config exists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Don’t require typing yes to continue, it’s inconvenient. --- src/znc.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/znc.cpp b/src/znc.cpp index 3280ddff..8a8af133 100644 --- a/src/znc.cpp +++ b/src/znc.cpp @@ -568,11 +568,7 @@ bool CZNC::WriteNewConfig(const CString& sConfigFile) { m_sConfigFile = ExpandConfigPath(sConfigFile); if (CFile::Exists(m_sConfigFile)) { - CUtils::PrintStatus(false, "The config file [" + m_sConfigFile + "] already exists."); - if (!CUtils::GetBoolInput("Would you like to overwrite it?", false)) - return false; - } else { - CUtils::PrintMessage("Building new config"); + CUtils::PrintStatus(false, "WARNING: config [" + m_sConfigFile + "] already exists."); } CUtils::PrintMessage(""); From 25609ec0bbbc36431880f0a45c0dc4ffccc67caa Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sun, 7 Sep 2014 16:24:12 +0200 Subject: [PATCH 8/9] makeconf: improve alternate location handling --- src/znc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/znc.cpp b/src/znc.cpp index 8a8af133..06098d59 100644 --- a/src/znc.cpp +++ b/src/znc.cpp @@ -802,7 +802,7 @@ bool CZNC::WriteNewConfig(const CString& sConfigFile) { } } if (!bFileOK) { - CUtils::GetInput("Please specify an alternate location (or \"stdout\" for displaying the config)", m_sConfigFile, m_sConfigFile); + while (!CUtils::GetInput("Please specify an alternate location", m_sConfigFile, "", "or \"stdout\" for displaying the config")); if (m_sConfigFile.Equals("stdout")) bFileOK = true; else From 40aa1bb34dc32f9701579662dcef7c24d72082df Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sun, 7 Sep 2014 16:39:49 +0200 Subject: [PATCH 9/9] makeconf: promote webadmin --- src/znc.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/znc.cpp b/src/znc.cpp index 06098d59..913e0af8 100644 --- a/src/znc.cpp +++ b/src/znc.cpp @@ -854,7 +854,8 @@ bool CZNC::WriteNewConfig(const CString& sConfigFile) { CUtils::PrintMessage(""); CUtils::PrintMessage("Try something like this in your IRC client...", true); CUtils::PrintMessage("/server " + sSSL + CString(uListenPort) + " " + sUser + ":", true); - CUtils::PrintMessage("And this in your browser...", true); + CUtils::PrintMessage(""); + CUtils::PrintMessage("To manage settings, users and networks, point your web browser to", true); CUtils::PrintMessage(sProtocol + "://:" + CString(uListenPort) + "/", true); CUtils::PrintMessage("");