Skip to content
Snippets Groups Projects
Commit a0d86eb1 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Make the Configuration Wizard look cool

This kind of sort of matches the SBBSCTRL Config Wizard flow and set of
settings now.

Pretty neat the stuff you can do with UIFC it turns out.

Also fixed a typo here and there and default to the currently-configured
deleted-message-viewing policy and stuff like that.
parent 61448e15
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #3788 failed
......@@ -46,6 +46,7 @@ char tmp[256];
char error[256];
int backup_level=5;
char* area_sort_desc[] = { "Index Position", "Long Name", "Short Name", "Internal Code Suffix", NULL };
static char title[128];
/* convenient space-saving global constants */
const char* nulstr="";
......@@ -168,31 +169,81 @@ void cfg_wizard(void)
return;
}
scfg_t saved_cfg = cfg;
do {
if(edit_sys_name() < 1)
if(edit_sys_name(true) < 1)
continue;
if(edit_sys_operator() < 1)
if(edit_sys_operator(true) < 1)
continue;
if(edit_sys_password() < 1)
if(edit_sys_password(true) < 1)
continue;
if(edit_sys_inetaddr() < 1)
if(edit_sys_inetaddr(true) < 1)
continue;
if(edit_sys_id() < 0)
if(edit_sys_id(true) < 0)
continue;
if(edit_sys_location() < 1)
if(edit_sys_location(true) < 1)
continue;
if(edit_sys_timezone() < 0)
if(edit_sys_timezone(true) < 0)
continue;
if(edit_sys_timefmt() < 0)
if(edit_sys_timefmt(true) < 0)
continue;
if(edit_sys_datefmt() < 0)
if(edit_sys_datefmt(true) < 0)
continue;
uifc.msg("Initial Setup Complete!");
if(edit_sys_newuser_policy(true) < 0)
continue;
if(edit_sys_alias_policy(true) < 0)
continue;
if(edit_sys_delmsg_policy(true) < 0)
continue;
if(memcmp(&saved_cfg, &cfg, sizeof(cfg)) == 0) {
uifc.scrn(title);
uifc.msg("No configuration changes made");
continue;
}
uifc.showbuf(WIN_HLP|WIN_DYN|WIN_L2R, 2, 2, 80, 20
,"System Password Verification"
,"At this point you must re-enter the system password that you created\n"
"earlier in the configuration wizard.\n"
"\n"
"This same password will be required of you when you logon to the BBS with\n"
"any user account that has System Operator (sysop) privileges\n"
"(i.e. security level 90 or higher).\n"
,NULL,NULL);
char pass[sizeof(cfg.sys_pass)];
do {
if(uifc.input(WIN_L2R|WIN_SAV, 0, 10, "SY", pass, sizeof(cfg.sys_pass)-1, K_PASSWORD | K_UPPER) < 0)
break;
} while(strcmp(cfg.sys_pass, pass) != 0);
if(strcmp(cfg.sys_pass, pass))
continue;
uifc.showbuf(WIN_HLP|WIN_DYN|WIN_L2R, 2, 2, 80, 20
,"Setup Wizard"
," ~ Initial Setup Complete! ~\n"
"\n"
"You have completed the initial configuration of the basic parameters\n"
"required to run Synchronet - the ultimate choice in BBS software\n"
"for the Internet Age.\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"Thank you for choosing Synchronet,\n"
" Rob Swindell (digital man)\n"
,NULL, NULL);
if(!uifc.confirm("Save Changes"))
continue;
if(strcmp(saved_cfg.sys_pass, cfg.sys_pass) != 0)
reencrypt_keys(saved_cfg.sys_pass, cfg.sys_pass);
cfg.new_install = new_install;
save_main_cfg(&cfg, backup_level);
save_msgs_cfg(&cfg, backup_level);
break;
} while(!uifc.confirm("Abort Setup Wizard?"));
} while(uifc.deny("Abort Setup Wizard"));
free_main_cfg(&cfg);
free_msgs_cfg(&cfg);
......@@ -482,8 +533,8 @@ int main(int argc, char **argv)
if((mopt[i]=(char *)malloc(64))==NULL)
allocfail(64);
SAFEPRINTF2(str,"Synchronet for %s v%s",PLATFORM_DESC,VERSION);
if(uifc.scrn(str)) {
SAFEPRINTF2(title,"Synchronet for %s v%s",PLATFORM_DESC,VERSION);
if(uifc.scrn(title)) {
printf(" USCRN (len=%d) failed!\n",uifc.scrn_len+1);
bail(1);
}
......@@ -502,8 +553,11 @@ int main(int argc, char **argv)
iniCloseFile(fp);
}
if(run_wizard
|| (cfg.new_install && uifc.msg("New install detected, starting Initial Setup Wizard") >= 0))
cfg_wizard();
|| (cfg.new_install && uifc.msg("New install detected, starting Initial Setup Wizard") >= 0)) {
cfg_wizard();
if(run_wizard)
bail(0);
}
i=0;
strcpy(mopt[i++],"Nodes");
......
......@@ -147,15 +147,19 @@ void guru_cfg(void);
void actsets_cfg(void);
void chan_cfg(void);
void mdm_cfg(int mdmnum);
int edit_sys_name();
int edit_sys_id();
int edit_sys_location();
int edit_sys_operator();
int edit_sys_password();
int edit_sys_inetaddr();
int edit_sys_timezone();
int edit_sys_timefmt();
int edit_sys_datefmt();
int edit_sys_name(bool wiz);
int edit_sys_id(bool wiz);
int edit_sys_location(bool wiz);
int edit_sys_operator(bool wiz);
int edit_sys_password(bool wiz);
int edit_sys_inetaddr(bool wiz);
int edit_sys_timezone(bool wiz);
int edit_sys_timefmt(bool wiz);
int edit_sys_datefmt(bool wiz);
int edit_sys_newuser_policy(bool wiz);
int edit_sys_alias_policy(bool wiz);
int edit_sys_delmsg_policy(bool wiz);
void reencrypt_keys(const char* old_pass, const char* new_pass);
int export_mdm(char *fname);
int code_ok(char *str);
int bits(long l);
......
......@@ -1180,7 +1180,7 @@ void msg_opts()
}
return;
case 0:
edit_sys_id();
edit_sys_id(false);
break;
case 1:
uifc.helpbuf=
......@@ -1451,43 +1451,7 @@ void msg_opts()
}
break;
case 16:
strcpy(opt[0],"Yes");
strcpy(opt[1],"No");
strcpy(opt[2],"Sysops Only");
opt[3][0]=0;
i=1;
uifc.helpbuf=
"`Users Can View Deleted Messages:`\n"
"\n"
"If this option is set to `Yes`, then users will be able to view messages\n"
"they've sent and deleted or messages sent to them and they've deleted\n"
"with the option of un-deleting the message before the message is\n"
"physically purged from the e-mail database.\n"
"\n"
"If this option is set to `No`, then when a message is deleted, it is no\n"
"longer viewable (with SBBS) by anyone.\n"
"\n"
"If this option is set to `Sysops Only`, then only sysops and sub-ops (when\n"
"appropriate) can view deleted messages.\n"
;
i=uifc.list(WIN_MID|WIN_SAV,0,0,0,&i,0
,"Users Can View Deleted Messages",opt);
if(!i && (cfg.sys_misc&(SM_USRVDELM|SM_SYSVDELM))
!=(SM_USRVDELM|SM_SYSVDELM)) {
cfg.sys_misc|=(SM_USRVDELM|SM_SYSVDELM);
uifc.changes=1;
}
else if(i==1 && cfg.sys_misc&(SM_USRVDELM|SM_SYSVDELM)) {
cfg.sys_misc&=~(SM_USRVDELM|SM_SYSVDELM);
uifc.changes=1;
}
else if(i==2 && (cfg.sys_misc&(SM_USRVDELM|SM_SYSVDELM))
!=SM_SYSVDELM) {
cfg.sys_misc|=SM_SYSVDELM;
cfg.sys_misc&=~SM_USRVDELM;
uifc.changes=1;
}
edit_sys_delmsg_policy(false);
break;
case 17:
uifc.helpbuf=
......
......@@ -923,7 +923,7 @@ void net_cfg()
done=1;
break;
case 0:
edit_sys_inetaddr();
edit_sys_inetaddr(false);
break;
case 1:
uifc.helpbuf=
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment