From c2a310c41c26f3fe0fc69e4d9356dd03153f7760 Mon Sep 17 00:00:00 2001
From: "Rob Swindell (on ChromeOS)" <rob@synchro.net>
Date: Sat, 25 Feb 2023 19:40:02 -0800
Subject: [PATCH] Define/use some more sensible defaults for new user Q's, etc.

We don't yet really work with a 0-byte main.ini file, but this gets
us a little closer.
---
 src/sbbs3/sbbsdefs.h  |  3 +++
 src/sbbs3/scfg/scfg.c |  2 +-
 src/sbbs3/scfglib1.c  | 18 +++++++++---------
 3 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/src/sbbs3/sbbsdefs.h b/src/sbbs3/sbbsdefs.h
index eddf5d2e27..2cd891743c 100644
--- a/src/sbbs3/sbbsdefs.h
+++ b/src/sbbs3/sbbsdefs.h
@@ -130,6 +130,9 @@
 #define UQ_COLORTERM	(1L<<20)	/* Ask if new user has color terminal	*/
 #define UQ_DUPNETMAIL	(1L<<21)	/* Don't allow duplicate e-mail address */
 
+#define DEFAULT_NEWUSER_QS (UQ_ALIASES | UQ_LOCATION | UQ_HANDLE | UQ_DUPHAND | UQ_SEX | UQ_BIRTH \
+							| UQ_REALNAME)
+
 								// Different bits in sys_misc				
 #define SM_CLOSED		(1<<0) 	// System is clsoed to New Users			
 #define SM_SYSSTAT		(1<<1) 	// Sysops activity included in statistics	
diff --git a/src/sbbs3/scfg/scfg.c b/src/sbbs3/scfg/scfg.c
index 6e6e142270..6ff22e049e 100644
--- a/src/sbbs3/scfg/scfg.c
+++ b/src/sbbs3/scfg/scfg.c
@@ -663,7 +663,7 @@ int main(int argc, char **argv)
 		SAFEPRINTF2(errormsg, "Error %d opening configuration file: %s", errno, str);
 		uifc.msg(errormsg);
 	} else {
-		cfg.new_install = iniReadBool(fp, ROOT_SECTION, "new_install", FALSE);
+		cfg.new_install = iniReadBool(fp, ROOT_SECTION, "new_install", TRUE);
 		iniCloseFile(fp);
 	}
 	if(run_wizard
diff --git a/src/sbbs3/scfglib1.c b/src/sbbs3/scfglib1.c
index 6458c47bb7..601cbd9150 100644
--- a/src/sbbs3/scfglib1.c
+++ b/src/sbbs3/scfglib1.c
@@ -128,7 +128,7 @@ BOOL read_main_cfg(scfg_t* cfg, char* error, size_t maxerrlen)
 
 	cfg->user_backup_level = iniGetInteger(ini, ROOT_SECTION, "user_backup_level", 5);
 	cfg->mail_backup_level = iniGetInteger(ini, ROOT_SECTION, "mail_backup_level", 5);
-	cfg->new_install = iniGetBool(ini, ROOT_SECTION, "new_install", FALSE);
+	cfg->new_install = iniGetBool(ini, ROOT_SECTION, "new_install", TRUE);
 	cfg->valuser = iniGetShortInt(ini, ROOT_SECTION, "valuser", 0);
 	cfg->erruser = iniGetShortInt(ini, ROOT_SECTION, "erruser", 0);
 	cfg->errlevel = (uchar)iniGetShortInt(ini, ROOT_SECTION, "errlevel", LOG_CRIT);
@@ -164,7 +164,7 @@ BOOL read_main_cfg(scfg_t* cfg, char* error, size_t maxerrlen)
 	/* New User Settings */
 	/*********************/
 	section = iniGetParsedSection(sections, "newuser", /* cut: */TRUE);
-	cfg->uq = iniGetUInteger(section, NULL, "questions", 0);
+	cfg->uq = iniGetUInteger(section, NULL, "questions", DEFAULT_NEWUSER_QS);
 
 	SAFECOPY(cfg->new_genders, iniGetString(section, NULL, "gender_options", "MFX", value));
 	SAFECOPY(cfg->new_pass, iniGetString(section, NULL, "password", "", value));
@@ -176,7 +176,7 @@ BOOL read_main_cfg(scfg_t* cfg, char* error, size_t maxerrlen)
 	SAFECOPY(new_shell, iniGetString(section, NULL, "command_shell", "default", value));
 	SAFECOPY(cfg->new_xedit, iniGetString(section, NULL, "editor", "", value));
 
-	cfg->new_level = iniGetInteger(section, NULL, "level", 0);
+	cfg->new_level = iniGetInteger(section, NULL, "level", 50);
 	cfg->new_flags1 = iniGetUInt32(section, NULL, "flags1", 0);
 	cfg->new_flags2 = iniGetUInt32(section, NULL, "flags2", 0);
 	cfg->new_flags3 = iniGetUInt32(section, NULL, "flags3", 0);
@@ -281,12 +281,12 @@ BOOL read_main_cfg(scfg_t* cfg, char* error, size_t maxerrlen)
 		char name[128];
 		SAFEPRINTF(name, "level:%u", i);
 		section = iniGetParsedSection(sections, name, /* cut: */TRUE);
-		cfg->level_timeperday[i] = iniGetInteger(section, NULL, "timeperday", 0);
-		cfg->level_timepercall[i] = iniGetInteger(section, NULL, "timepercall", 0);
-		cfg->level_callsperday[i] = iniGetInteger(section, NULL, "callsperday", 0);
-		cfg->level_linespermsg[i] = iniGetInteger(section, NULL, "linespermsg", 0);
-		cfg->level_postsperday[i] = iniGetInteger(section, NULL, "postsperday", 0);
-		cfg->level_emailperday[i] = iniGetInteger(section, NULL, "emailperday", 0);
+		cfg->level_timeperday[i] = iniGetInteger(section, NULL, "timeperday", i);
+		cfg->level_timepercall[i] = iniGetInteger(section, NULL, "timepercall", i);
+		cfg->level_callsperday[i] = iniGetInteger(section, NULL, "callsperday", i);
+		cfg->level_linespermsg[i] = iniGetInteger(section, NULL, "linespermsg", i);
+		cfg->level_postsperday[i] = iniGetInteger(section, NULL, "postsperday", i);
+		cfg->level_emailperday[i] = iniGetInteger(section, NULL, "emailperday", i);
 		cfg->level_misc[i] = iniGetUInteger(section, NULL, "settings", 0);
 		cfg->level_expireto[i] = iniGetInteger(section, NULL, "expireto", 0);
 		cfg->level_freecdtperday[i] = iniGetBytes(section, NULL, "freecdtperday", 1, 0);
-- 
GitLab