Skip to content
Snippets Groups Projects
Select Git revision
  • 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
  • new_user_dat
  • 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

user_settings_lib.js

Blame
  • user_settings_lib.js 1.70 KiB
    // This is a library of functions to allow the user to change their settings.
    //
    // *** NOTE - This will only work on Synchronet v3.20 or above!
    
    "use strict";
    
    require("gettext.js", "gettext");
    
    
    // Prompts the user for their preferred download protocol & auto-hangup setting
    //
    // Parameters:
    //  pUserObj: Optional - A User object representing the current user
    //  pFileCfg: Optional - A cfglib object with file.ini loaded
    function prompt_user_for_download_protocol(pUserObj, pFileCfg)
    {
    	var thisuser;
    	if (typeof(pUserObj) === "object" && pUserObj.hasOwnProperty("download_protocol"))
    		thisuser = pUserObj;
    	else
    		thisuser = new User(user.number);
    
    	var file_cfg;
    	if (typeof(pFileCfg) === "object" && pFileCfg.hasOwnProperty("protocol"))
    		file_cfg = pFileCfg;
    	else
    	{
    		var cfglib = load({}, "cfglib.js");
    		file_cfg = cfglib.read("file.ini");
    	}
    
    	var c = 0;
    	var keylist = 'Q';
    	console.newline();
    	console.print(gettext("Choose a default file transfer protocol (or [ENTER] for None):"));
    	console.newline(2);
    	for (var code in file_cfg.protocol)
    	{
    		if (!thisuser.compare_ars(file_cfg.protocol[code].ars) || file_cfg.protocol[code].dlcmd.length === 0)
    			continue;
    		console.putmsg(format(bbs.text(bbs.text.TransferProtLstFmt), String(file_cfg.protocol[code].key), file_cfg.protocol[code].name));
    
    		keylist += String(file_cfg.protocol[code].key);
    		if (c % 2 === 1)
    			console.newline();
    		++c;
    	}
    	console.mnemonics(bbs.text(bbs.text.ProtocolOrQuit));
    	var kp = console.getkeys(keylist);
    	if (kp !== 'Q' && !console.aborted)
    	{
    		thisuser.download_protocol = kp;
    		if (kp && console.yesno(bbs.text(bbs.text.HangUpAfterXferQ)))
    			thisuser.settings |= USER_AUTOHANG;
    		else
    			thisuser.settings &= ~USER_AUTOHANG;
    	}
    }
    
    this;