Allow leading/trailing spaces in the config

This is especially useful for all those ASCII-art-in-the-MOTD guys.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2010 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2010-06-06 09:47:30 +00:00
parent 35ef37acc4
commit a3ef9b2d40
+11 -3
View File
@@ -1106,8 +1106,9 @@ bool CZNC::DoRehash(CString& sError)
while (File.ReadLine(sLine)) {
uLineNum++;
// Remove all leading / trailing spaces and line endings
sLine.Trim();
// Remove all leading spaces and trailing line endings
sLine.TrimLeft();
sLine.TrimRight("\r\n");
if ((sLine.empty()) || (sLine[0] == '#') || (sLine.Left(2) == "//")) {
continue;
@@ -1251,8 +1252,15 @@ bool CZNC::DoRehash(CString& sError)
// If we have a regular line, figure out where it goes
CString sName = sLine.Token(0, false, "=");
CString sValue = sLine.Token(1, true, "=");
// Only remove the first space, people might want
// leading spaces (e.g. in the MOTD).
if (sValue.Left(1) == " ")
sValue.LeftChomp();
// We don't have any names with spaces, trim all
// leading/trailing spaces.
sName.Trim();
sValue.Trim();
if ((!sName.empty()) && (!sValue.empty())) {
if (pUser) {