Skip to content
Snippets Groups Projects
Select Git revision
  • dd_msg_reader_list_personal_email_in_reverse_choose_msg_fix
  • dailybuild_linux-x64
  • dailybuild_win32
  • master default protected
  • sqlite
  • rip_abstraction
  • dailybuild_macos-armv8
  • dd_file_lister_filanem_in_desc_color
  • mode7
  • dd_msg_reader_are_you_there_warning_improvement
  • c23-playing
  • syncterm-1.3
  • syncterm-1.2
  • test-build
  • hide_remote_connection_with_telgate
  • 638-can-t-control-c-during-a-file-search
  • add_body_to_pager_email
  • mingw32-build
  • cryptlib-3.4.7
  • ree/mastermind
  • sbbs320d
  • syncterm-1.6
  • syncterm-1.5
  • syncterm-1.4
  • sbbs320b
  • syncterm-1.3
  • syncterm-1.2
  • syncterm-1.2rc6
  • syncterm-1.2rc5
  • push
  • syncterm-1.2rc4
  • syncterm-1.2rc2
  • syncterm-1.2rc1
  • sbbs319b
  • sbbs318b
  • goodbuild_linux-x64_Sep-01-2020
  • goodbuild_win32_Sep-01-2020
  • goodbuild_linux-x64_Aug-31-2020
  • goodbuild_win32_Aug-31-2020
  • goodbuild_win32_Aug-30-2020
40 results

xtrn_sec.js

Blame
  • xtrn_sec.js 3.26 KiB
    // xtrn_sec.js
    
    // Synchronet External Program Section
    // Menus displayed to users via Telnet/RLogin
    
    // $Id$
    
    load("sbbsdefs.js");
    
    /* text.dat entries */
    const R_ExternalPrograms	=123
    const NoXtrnPrograms		=379
    const XtrnProgLstHdr		=380
    const XtrnProgLstTitles		=381
    const XtrnProgLstUnderline	=382
    const XtrnProgLstFmt		=383
    const WhichXtrnProg			=384
    
    while(bbs.online) {
    
    	if(user.security.restrictions&UFLAG_X) {
    		write(bbs.text(R_ExternalPrograms));
    		break;
    	}
    
    	if(!xtrn_area.sec_list.length) {
    		write(bbs.text(NoXtrnPrograms));
    		break; 
    	}
    
    	var xsec=0;
    	if(xtrn_area.sec_list.length > 1) {
    		if(file_exists(system.text_dir + "menu/xtrn_sec.asc")) {
    			bbs.menu("xtrn_sec");
    			xsec=console.getnum(xtrn_area.sec_list.length);
    			if(xsec<=0)
    				break;
    			xsec--;
    		}
    		else {
    			for(i in xtrn_area.sec_list)
    				console.uselect(Number(i),"External Program Section"
    					,xtrn_area.sec_list[i].name);
    			xsec=console.uselect(); 
    		}
    	}
    	if(xsec<0)
    		break;
    
    	while(bbs.online) {
    
    		if(!xtrn_area.sec_list[xsec].prog_list.length) {
    			write(bbs.text(NoXtrnPrograms));
    			console.pause();
    			break; 
    		}
    
    		if(file_exists(system.text_dir + "menu/xtrn" + (xtrn_area.sec_list[xsec].number+1) + ".asc")) {
    			bbs.menu("xtrn" + (xtrn_area.sec_list[xsec].number+1)); 
    		}
    		else {
    			printf(bbs.text(XtrnProgLstHdr),xtrn_area.sec_list[xsec].name);
    			write(bbs.text(XtrnProgLstTitles));
    			if(xtrn_area.sec_list[xsec].prog_list.length >= 10) {
    				write("     ");
    				write(bbs.text(XtrnProgLstTitles)); 
    			}
    			console.crlf();
    			write(bbs.text(XtrnProgLstUnderline));
    			if(xtrn_area.sec_list[xsec].prog_list.length >= 10) {
    				write("     ");
    				write(bbs.text(XtrnProgLstUnderline)); 
    			}
    			console.crlf();
    			if(xtrn_area.sec_list[xsec].prog_list.length >= 10)
    				n=(xtrn_area.sec_list[xsec].prog_list.length/2)+(xtrn_area.sec_list[xsec].prog_list.length&1);
    			else
    				n=xtrn_area.sec_list[xsec].prog_list.length;
    
    			for(i=0;i<n;i++) {
    				printf(bbs.text(XtrnProgLstFmt),i+1
    					,xtrn_area.sec_list[xsec].prog_list[i].name
    					,xtrn_area.sec_list[xsec].prog_list[i].cost);
    
    				if(xtrn_area.sec_list[xsec].prog_list.length>=10) {
    					j=(xtrn_area.sec_list[xsec].prog_list.length/2)+i+(xtrn_area.sec_list[xsec].prog_list.length&1);
    					if(j<xtrn_area.sec_list[xsec].prog_list.length) {
    						log(format("%d %d",j,xtrn_area.sec_list[xsec].prog_list.length));
    						log(xtrn_area.sec_list[xsec].prog_list[j]);
    						write("     ");
    						printf(bbs.text(XtrnProgLstFmt),j+1
    							,xtrn_area.sec_list[xsec].prog_list[j].name
    							,xtrn_area.sec_list[xsec].prog_list[j].cost); 
    					}
    				}
    
    				console.crlf(); 
    			}
    			bbs.node_sync();
    			console.mnemonics(bbs.text(WhichXtrnProg)); 
    		}
    		system.node_list[bbs.node_num-1].aux=0; /* aux is 0, only if at menu */
    		bbs.action=NODE_XTRN;
    		bbs.node_sync();
    		if((i=console.getnum(xtrn_area.sec_list[xsec].prog_list.length))<1)
    			break;
    		i--;
    		if(file_exists(system.text_dir + "menu/xtrn/" + xtrn_area.sec_list[xsec].prog_list[i].code)) {
    			menu("xtrn/" + xtrn_area.sec_list[xsec].prog_list[i].code);
    			console.line_counter=0;
    		}
    		bbs.exec_xtrn(xtrn_area.sec_list[xsec].prog_list[i].code); 
    
    		if(xtrn_area.sec_list[xsec].prog_list[i].settingsXTRN_PAUSE)
    			bbs.line_counter=2;	/* force a pause before CLS */
    	}
    	if(xtrn_area.sec_list.length<2)
    		break; 
    }