From fd5b39c3890ba15c2c270fb655fd4b39fe40b752 Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Sun, 10 May 2020 22:23:47 +0000 Subject: [PATCH] Delete the old hard-coded External Program Section (xtrn_sec) implementation. The system must use an external program module (e.g. xtrn_sec.js) now or this function will just display/log an error and exit. --- src/sbbs3/xtrn_sec.cpp | 152 ++--------------------------------------- 1 file changed, 5 insertions(+), 147 deletions(-) diff --git a/src/sbbs3/xtrn_sec.cpp b/src/sbbs3/xtrn_sec.cpp index f272229363..31578a8e55 100644 --- a/src/sbbs3/xtrn_sec.cpp +++ b/src/sbbs3/xtrn_sec.cpp @@ -44,157 +44,15 @@ int sbbs_t::xtrn_sec(const char* section) { char str[MAX_PATH+1]; - int xsec; - uint i,j,k,*usrxtrn,usrxtrns,*usrxsec,usrxsecs; - long l; - if(cfg.xtrnsec_mod[0] != '\0') { - SAFEPRINTF2(str, "%s %s", cfg.xtrnsec_mod, section); - return exec_bin(str, &main_csi); + if(cfg.xtrnsec_mod[0] == '\0') { + errormsg(WHERE, ERR_CHK, "xtrnsec_mod", 0); + return 1; } - - if(useron.rest&FLAG('X')) { - bputs(text[R_ExternalPrograms]); - return(1); - } - - if(!cfg.total_xtrns || !cfg.total_xtrnsecs) { - bputs(text[NoXtrnPrograms]); - return(1); - } - - if((usrxtrn=(uint *)malloc(cfg.total_xtrns*sizeof(int)))==NULL) { - errormsg(WHERE,ERR_ALLOC,nulstr,cfg.total_xtrns); - return(1); - } - if((usrxsec=(uint *)malloc(cfg.total_xtrnsecs*sizeof(int)))==NULL) { - errormsg(WHERE,ERR_ALLOC,nulstr,cfg.total_xtrnsecs); - free(usrxtrn); - return(1); - } - - while(online) { - for(i=0,usrxsecs=0;i<cfg.total_xtrnsecs;i++) - if(chk_ar(cfg.xtrnsec[i]->ar,&useron,&client)) - usrxsec[usrxsecs++]=i; - if(!usrxsecs) { - bputs(text[NoXtrnPrograms]); - free(usrxtrn); - free(usrxsec); - return(1); - } - if(usrxsecs>1) { - if(menu_exists("xtrn_sec")) { - menu("xtrn_sec"); - xsec=getnum(usrxsecs); - if(xsec<=0) - break; - xsec--; - xsec=usrxsec[xsec]; - } - else { - for(i=0;i<cfg.total_xtrnsecs;i++) - uselect(1,i,"External Program Section" - ,cfg.xtrnsec[i]->name,cfg.xtrnsec[i]->ar); - xsec=uselect(0,0,0,0,0); - } - if(xsec==-1) - break; - } - else - xsec=0; - - while(!chk_ar(cfg.xtrnsec[xsec]->ar,&useron,&client)) - xsec++; - - if(xsec>=cfg.total_xtrnsecs) { - bputs(text[NoXtrnPrograms]); - free(usrxtrn); - free(usrxsec); - return(1); - } - - while(online) { - for(i=0,usrxtrns=0;i<cfg.total_xtrns; i++) { - if(cfg.xtrn[i]->sec!=xsec) - continue; - if(cfg.xtrn[i]->event && cfg.xtrn[i]->misc&EVENTONLY) - continue; - if(!chk_ar(cfg.xtrn[i]->ar,&useron,&client)) - continue; - usrxtrn[usrxtrns++]=i; - } - if(!usrxtrns) { - bputs(text[NoXtrnPrograms]); - pause(); - break; - } - sprintf(str,"xtrn%u",xsec+1); - if(menu_exists(str)) { - menu(str); - } - else { - bprintf(text[XtrnProgLstHdr],cfg.xtrnsec[xsec]->name); - bputs(text[XtrnProgLstTitles]); - if(usrxtrns>=10) { - bputs(" "); - bputs(text[XtrnProgLstTitles]); - } - CRLF; - bputs(text[XtrnProgLstUnderline]); - if(usrxtrns>=10) { - bputs(" "); - bputs(text[XtrnProgLstUnderline]); - } - CRLF; - if(usrxtrns>=10) - j=(usrxtrns/2)+(usrxtrns&1); - else - j=usrxtrns; - for(i=0;i<j && !msgabort();i++) { - bprintf(text[XtrnProgLstFmt],i+1 - ,cfg.xtrn[usrxtrn[i]]->name,cfg.xtrn[usrxtrn[i]]->cost); - if(usrxtrns>=10) { - k=(usrxtrns/2)+i+(usrxtrns&1); - if(k<usrxtrns) { - bputs(" "); - bprintf(text[XtrnProgLstFmt],k+1 - ,cfg.xtrn[usrxtrn[k]]->name - ,cfg.xtrn[usrxtrn[k]]->cost); - } - } - CRLF; - } - ASYNC; - mnemonics(text[WhichXtrnProg]); - } - getnodedat(cfg.node_num,&thisnode,1); - thisnode.aux=0; /* aux is 0, only if at menu */ - putnodedat(cfg.node_num,&thisnode); - action=NODE_XTRN; - SYNC; - if((l=getnum(usrxtrns))<1) - break; - l--; - sprintf(str,"xtrn/%s",cfg.xtrn[usrxtrn[l]]->code); - if(menu_exists(str)) { - menu(str); - lncntr=0; - } - exec_xtrn(usrxtrn[l]); - - if(cfg.xtrn[usrxtrn[l]]->misc&XTRN_PAUSE) - lncntr=2; /* force a pause before CLS */ - } - if(usrxsecs<2) - break; - } - free(usrxtrn); - free(usrxsec); - return(0); + SAFEPRINTF2(str, "%s %s", cfg.xtrnsec_mod, section); + return exec_bin(str, &main_csi); } - const char *hungupstr="\1n\1h%s\1n hung up on \1h%s\1n %s\r\n"; /****************************************************************************/ -- GitLab