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

Update/use newuserdefaults()

Update newuserdefaults() to use the new sysop-configured Chat and QWK new user settings/values (commit 56b8fd86).

Use newuserdefaults() in newuser.cpp and makeuser.c, eliminating a lot of copy/pasta.
parent 2dd53c8b
No related branches found
No related tags found
No related merge requests found
......@@ -116,41 +116,7 @@ int main(int argc, char **argv)
/* Set Defaults */
/****************/
/* security */
user.level=scfg.new_level;
user.flags1=scfg.new_flags1;
user.flags2=scfg.new_flags2;
user.flags3=scfg.new_flags3;
user.flags4=scfg.new_flags4;
user.rest=scfg.new_rest;
user.exempt=scfg.new_exempt;
user.cdt=scfg.new_cdt;
user.min=scfg.new_min;
user.freecdt=scfg.level_freecdtperday[user.level];
if(scfg.total_fcomps)
SAFECOPY(user.tmpext,scfg.fcomp[0]->ext);
else
SAFECOPY(user.tmpext,"ZIP");
for(i=0;i<scfg.total_xedits;i++)
if(!stricmp(scfg.xedit[i]->code,scfg.new_xedit))
break;
if(i<scfg.total_xedits)
user.xedit=i+1;
user.shell=scfg.new_shell;
user.misc=(scfg.new_misc&~(DELETED|INACTIVE|QUIET|NETMAIL));
user.misc|=AUTOTERM; /* No way to frob the default value... */
user.qwk=QWK_DEFAULT;
user.firston=(time32_t)now;
user.laston=(time32_t)now; /* must set this or user may be purged prematurely */
user.pwmod=(time32_t)now;
user.sex=' ';
user.prot=scfg.new_prot;
if(scfg.new_expire)
user.expire=(time32_t)(now+((long)scfg.new_expire*24L*60L*60L));
newuserdefaults(&scfg, &user);
for(i=first_arg;i<argc;i++) {
if(argv[i][0]=='-') {
......
......@@ -56,6 +56,7 @@ BOOL sbbs_t::newuser()
thisnode.connection=node_connection;
putnodedat(cfg.node_num,&thisnode);
memset(&useron,0,sizeof(user_t)); /* Initialize user info to null */
newuserdefaults(&cfg, &useron);
if(cfg.new_pass[0] && online==ON_REMOTE) {
c=0;
while(++c<4) {
......@@ -74,17 +75,6 @@ BOOL sbbs_t::newuser()
}
/* Sets defaults per sysop config */
useron.misc|=(cfg.new_misc&~(DELETED|INACTIVE|QUIET|NETMAIL));
useron.qwk = cfg.new_qwk;
useron.chat = cfg.new_chat;
useron.firston=useron.laston=useron.pwmod=time32(NULL);
if(cfg.new_expire) {
now=time(NULL);
useron.expire=(time32_t)(now+((long)cfg.new_expire*24L*60L*60L));
} else
useron.expire=0;
useron.sex=' ';
useron.prot=cfg.new_prot;
SAFECOPY(useron.comp,client_name); /* hostname or CID name */
SAFECOPY(useron.ipaddr,cid); /* IP address or CID number */
if((i=finduserstr(0, USER_IPADDR, cid, /* del */true))!=0) { /* Duplicate IP address */
......@@ -93,7 +83,6 @@ BOOL sbbs_t::newuser()
logline(LOG_NOTICE,"N!",useron.comment);
}
SAFECOPY(useron.alias,"New"); /* just for status line */
SAFECOPY(useron.modem,connection);
if(!lastuser(&cfg)) { /* Automatic sysop access for first user */
bprintf("Creating sysop account... System password required.\r\n");
......@@ -103,29 +92,8 @@ BOOL sbbs_t::newuser()
useron.exempt=useron.flags1=useron.flags2=0xffffffffUL;
useron.flags3=useron.flags4=0xffffffffUL;
useron.rest=0L;
} else {
useron.level=cfg.new_level;
useron.flags1=cfg.new_flags1;
useron.flags2=cfg.new_flags2;
useron.flags3=cfg.new_flags3;
useron.flags4=cfg.new_flags4;
useron.rest=cfg.new_rest;
useron.exempt=cfg.new_exempt;
}
useron.cdt=cfg.new_cdt;
useron.min=cfg.new_min;
useron.freecdt=cfg.level_freecdtperday[useron.level];
if(cfg.total_fcomps)
SAFECOPY(useron.tmpext,cfg.fcomp[0]->ext);
else
SAFECOPY(useron.tmpext,supported_archive_formats[0]);
useron.shell=cfg.new_shell;
useron.alias[0]=0;
kmode=(cfg.uq&UQ_NOEXASC)|K_EDIT|K_AUTODEL|K_TRIM;
if(!(cfg.uq&UQ_NOUPRLWR))
kmode|=K_UPRLWR;
......
......@@ -2943,10 +2943,12 @@ int newuserdefaults(scfg_t* cfg, user_t* user)
else
SAFECOPY(user->tmpext,"zip");
user->shell=cfg->new_shell;
user->misc=cfg->new_misc|(AUTOTERM|COLOR);
user->prot=cfg->new_prot;
user->qwk=QWK_DEFAULT;
user->shell = cfg->new_shell;
user->misc = cfg->new_misc|(AUTOTERM|COLOR);
user->misc &= ~(DELETED|INACTIVE|QUIET|NETMAIL);
user->prot = cfg->new_prot;
user->qwk = cfg->new_qwk;
user->chat = cfg->new_chat;
for(i=0;i<cfg->total_xedits;i++)
if(!stricmp(cfg->xedit[i]->code,cfg->new_xedit) && chk_ar(cfg,cfg->xedit[i]->ar, user, /* client: */NULL))
......
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