Skip to content
Snippets Groups Projects
Commit c6d3db7a authored by rswindell's avatar rswindell
Browse files

Make sure the most recent destination netmail address is always at the

front of the list/array, even if it was already in the list.
parent e32e21f3
Branches
Tags
No related merge requests found
......@@ -8,6 +8,7 @@
load("sbbsdefs.js");
var text = load({}, "text.js");
var userprops = load({}, "userprops.js");
var ini_section = "netmail sent";
const NetmailAddressHistoryLength = 10;
......@@ -57,17 +58,19 @@ while(bbs.online) {
if((netmail&NMAIL_FILE) && !console.noyes("Attach a file"))
wm_mode = WM_FILE;
console.print(bbs.text(text.EnterNetMailAddress));
var addr_list = userprops.get("netmail sent", "address", []) || [];
var addr_list = userprops.get(ini_section, "address", []) || [];
var addr = console.getstr(60, K_LINE, addr_list);
if(!addr || console.aborted)
break;
if(bbs.netmail(addr, wm_mode)) {
if(addr_list.indexOf(addr) == -1)
addr_list.unshift(addr);
var addr_idx = addr_list.indexOf(addr);
if(addr_idx >= 0)
addr_list.splice(addr_idx, 1);
addr_list.unshift(addr);
if(addr_list.length > NetmailAddressHistoryLength)
addr_list.length = NetmailAddressHistoryLength;
userprops.set("netmail sent", "address", addr_list);
userprops.set("netmail sent", "localtime", new Date().toString());
userprops.set(ini_section, "address", addr_list);
userprops.set(ini_section, "localtime", new Date().toString());
}
break;
case 'Q': // Quit
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment