--- sbbs/src/sbbs3/logon.cpp 2018/04/24 16:41:23 1.1 +++ sbbs/src/sbbs3/logon.cpp 2018/04/24 16:43:03 1.1.1.2 @@ -2,13 +2,13 @@ /* Synchronet user logon routines */ -/* $Id: logon.cpp,v 1.1 2018/04/24 16:41:23 root Exp $ */ +/* $Id: logon.cpp,v 1.1.1.2 2018/04/24 16:43:03 root Exp $ */ /**************************************************************************** * @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * * - * Copyright 2006 Rob Swindell - http://www.synchro.net/copyright.html * + * Copyright 2011 Rob Swindell - http://www.synchro.net/copyright.html * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License * @@ -74,34 +74,21 @@ bool sbbs_t::logon() if(SYSOP && !(cfg.sys_misc&SM_R_SYSOP)) return(false); -#if 0 - if(cur_ratecode,cfg.new_xedit) - && chk_ar(cfg.xedit[i]->ar,&useron)) + && chk_ar(cfg.xedit[i]->ar,&useron,&client)) break; if(iar,&useron)) { + if(!chk_ar(cfg.shell[useron.shell]->ar,&useron,&client)) { useron.shell=cfg.new_shell; - if(!chk_ar(cfg.shell[useron.shell]->ar,&useron)) { + if(!chk_ar(cfg.shell[useron.shell]->ar,&useron,&client)) { for(i=0;iar,&useron)) + if(chk_ar(cfg.shell[i]->ar,&useron,&client)) break; if(i==cfg.total_shells) useron.shell=0; @@ -234,10 +206,6 @@ bool sbbs_t::logon() CLS; if(useron.rows) rows=useron.rows; -#if 0 /* no such thing as local logon */ - else if(online==ON_LOCAL) - rows=cfg.node_scrnlen-1; -#endif unixtodstr(&cfg,logontime,str); if(!strncmp(str,useron.birth,5) && !(useron.rest&FLAG('Q'))) { bputs(text[HappyBirthday]); @@ -245,14 +213,7 @@ bool sbbs_t::logon() CLS; user_event(EVENT_BIRTHDAY); } - unixtodstr(&cfg,useron.laston,tmp); - if(strcmp(str,tmp)) { /* str still equals logon time */ - useron.ltoday=1; - useron.ttoday=useron.etoday=useron.ptoday=useron.textra=0; - useron.freecdt=cfg.level_freecdtperday[useron.level]; - } - else - useron.ltoday++; + useron.ltoday++; gettimeleft(); sprintf(str,"%sfile/%04u.dwn",cfg.data_dir,useron.number); @@ -309,7 +270,7 @@ bool sbbs_t::logon() bputs(text[NoMoreLogons]); sprintf(str,"(%04u) %-25s Out of logons" ,useron.number,useron.alias); - logline("+!",str); + logline(LOG_NOTICE,"+!",str); hangup(); return(false); } @@ -317,7 +278,7 @@ bool sbbs_t::logon() bputs(text[R_Logons]); sprintf(str,"(%04u) %-25s Out of logons" ,useron.number,useron.alias); - logline("+!",str); + logline(LOG_NOTICE,"+!",str); hangup(); return(false); } @@ -340,7 +301,7 @@ bool sbbs_t::logon() || strchr(useron.name,0xff) || (cfg.uq&UQ_DUPREAL && userdatdupe(useron.number,U_NAME,LEN_NAME - ,useron.name,0))) + ,useron.name,0,0))) bputs(text[YouCantUseThatName]); else break; @@ -357,7 +318,7 @@ bool sbbs_t::logon() || strchr(useron.handle,0xff) || (cfg.uq&UQ_DUPHAND && userdatdupe(useron.number,U_HANDLE,LEN_HANDLE - ,useron.handle,0)) + ,useron.handle,0,0)) || trashcan(useron.handle,"name")) bputs(text[YouCantUseThatName]); else @@ -383,7 +344,10 @@ bool sbbs_t::logon() break; } if(cfg.uq&UQ_PHONE && !useron.phone[0]) { - i=yesno(text[CallingFromNorthAmericaQ]); + if(text[CallingFromNorthAmericaQ][0]) + i=yesno(text[CallingFromNorthAmericaQ]); + else + i=0; while(online) { bputs(text[EnterYourPhoneNumber]); if(i) { @@ -422,10 +386,10 @@ bool sbbs_t::logon() if(!online) { sprintf(str,"(%04u) %-25s Unsuccessful logon" ,useron.number,useron.alias); - logline("+!",str); + logline(LOG_NOTICE,"+!",str); return(false); } - strcpy(useron.modem,connection); + SAFECOPY(useron.modem,connection); useron.logons++; putuserdat(&cfg,&useron); getmsgptrs(); @@ -461,13 +425,13 @@ bool sbbs_t::logon() ,totallogons,useron.alias ,cfg.sys_misc&SM_LISTLOC ? useron.location : useron.note ,tm.tm_hour,tm.tm_min - ,connection,useron.ltoday); + ,connection,useron.ltoday > 999 ? 999 : useron.ltoday); write(file,str,strlen(str)); close(file); } if(cfg.sys_logon[0]) /* execute system logon event */ - external(cmdstr(cfg.sys_logon,nulstr,nulstr,NULL),EX_OUTR|EX_OUTL); /* EX_SH */ + external(cmdstr(cfg.sys_logon,nulstr,nulstr,NULL),EX_STDOUT); /* EX_SH */ if(qwklogon) return(true); @@ -486,7 +450,7 @@ bool sbbs_t::logon() bprintf(text[LiMailWaiting],mailw); strcpy(str,text[LiSysopIs]); if(startup->options&BBS_OPT_SYSOP_AVAILABLE - || (cfg.sys_chat_ar[0] && chk_ar(cfg.sys_chat_ar,&useron))) + || (cfg.sys_chat_ar[0] && chk_ar(cfg.sys_chat_ar,&useron,&client))) strcat(str,text[LiSysopAvailable]); else strcat(str,text[LiSysopNotAvailable]); @@ -494,7 +458,7 @@ bool sbbs_t::logon() } if(sys_status&SS_EVENT) - bprintf(text[ReducedTime],timestr(&event_time)); + bprintf(text[ReducedTime],timestr(event_time)); getnodedat(cfg.node_num,&thisnode,1); thisnode.misc&=~(NODE_AOFF|NODE_POFF); if(useron.chat&CHAT_NOACT) @@ -519,11 +483,9 @@ bool sbbs_t::logon() } if(node.status==NODE_INUSE && i!=cfg.node_num && node.useron==useron.number && !SYSOP && !(useron.exempt&FLAG('G'))) { - strcpy(tmp,"On two nodes at the same time"); - sprintf(str,"(%04u) %-25s %s" - ,useron.number,useron.alias,tmp); - logline("+!",str); - errorlog(tmp); + SAFEPRINTF2(str,"(%04u) %-25s On two nodes at the same time" + ,useron.number,useron.alias); + logline(LOG_NOTICE,"+!",str); bputs(text[UserOnTwoNodes]); hangup(); return(false); @@ -553,13 +515,13 @@ bool sbbs_t::logon() sys_status&=~SS_PAUSEON; /* Turn off the pause override flag */ if(online==ON_REMOTE) rioctl(IOSM|ABORT); /* Turn abort ability on */ - if(mailw) { + if(text[ReadYourMailNowQ][0] && mailw) { if(yesno(text[ReadYourMailNowQ])) readmail(useron.number,MAIL_YOUR); } - if(usrgrps && useron.misc&ASK_NSCAN && yesno(text[NScanAllGrpsQ])) + if(usrgrps && useron.misc&ASK_NSCAN && text[NScanAllGrpsQ][0] && yesno(text[NScanAllGrpsQ])) scanallsubs(SCAN_NEW); - if(usrgrps && useron.misc&ASK_SSCAN && yesno(text[SScanAllGrpsQ])) + if(usrgrps && useron.misc&ASK_SSCAN && text[SScanAllGrpsQ][0] && yesno(text[SScanAllGrpsQ])) scanallsubs(SCAN_TOYOU); return(true); } @@ -575,7 +537,9 @@ ulong sbbs_t::logonstats() char str[MAX_PATH+1]; int dsts,csts; uint i; + time32_t update32_t=0; time_t update_t=0; + time32_t now32; stats_t stats; node_t node; struct tm tm, update_tm; @@ -587,10 +551,12 @@ ulong sbbs_t::logonstats() errormsg(WHERE,ERR_OPEN,str,O_RDWR); return(0L); } - read(dsts,&update_t,4); /* Last updated */ + read(dsts,&update32_t,4); /* Last updated */ + update_t=update32_t; read(dsts,&stats.logons,4); /* Total number of logons on system */ close(dsts); now=time(NULL); + now32=now; if(update_t>now+(24L*60L*60L)) /* More than a day in the future? */ errormsg(WHERE,ERR_CHK,"Daily stats time stamp",update_t); if(localtime_r(&update_t,&update_tm)==NULL) @@ -600,7 +566,7 @@ ulong sbbs_t::logonstats() if((tm.tm_mday>update_tm.tm_mday && tm.tm_mon==update_tm.tm_mon) || tm.tm_mon>update_tm.tm_mon || tm.tm_year>update_tm.tm_year) { - sprintf(str,"New Day - Prev: %s ",timestr(&update_t)); + sprintf(str,"New Day - Prev: %s ",timestr(update_t)); logentry("!=",str); sys_status|=SS_DAILY; /* New Day !!! */ @@ -626,7 +592,7 @@ ulong sbbs_t::logonstats() continue; } lseek(dsts,8L,SEEK_SET); /* Skip time and logons */ - write(csts,&now,4); + write(csts,&now32,4); read(dsts,&stats.ltoday,4); write(csts,&stats.ltoday,4); lseek(dsts,4L,SEEK_CUR); /* Skip total time on */ @@ -648,7 +614,7 @@ ulong sbbs_t::logonstats() write(csts,&stats.ftoday,4); close(csts); lseek(dsts,0L,SEEK_SET); /* Go back to beginning */ - write(dsts,&now,4); /* Update time stamp */ + write(dsts,&now32,4); /* Update time stamp */ lseek(dsts,4L,SEEK_CUR); /* Skip total logons */ stats.ltoday=0; write(dsts,&stats.ltoday,4); /* Logons today to 0 */