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

send_msg() now stores the inter-bbs "sent msg" recipient and time to the user

property file (data/user/*.ini), like sbbsimsg.js used to before rev 1.30 when
I moved the send_msg() functionality to this lib but failed to add the property
file update logic. Fixed.
parent 570b1181
No related branches found
No related tags found
No related merge requests found
......@@ -4,7 +4,11 @@
// $Id$
load("sockdefs.js"); // SOCK_DGRAM
require("sockdefs.js", 'SOCK_DGRAM');
const SentAddressHistoryLength = 10;
const props_sent = "imsg sent";
const props_recv = "imsg received";
// Read the list of systems into list array
var filename = system.ctrl_dir + "sbbsimsg.lst";
......@@ -159,6 +163,7 @@ function poll_systems(sent, interval, timeout, callback)
var message = receive_active_users();
if(message == null)
continue;
replies++;
var result = parse_active_users(message);
......@@ -183,6 +188,17 @@ function send_msg(dest, msg, from)
sock.close();
if(result < 1)
return "MSP Send to " + host + " failed with error " + sock.last_error;
var userprops = load({}, "userprops.js")
var addr_list = userprops.get(props_sent, "address", []);
var addr_idx = addr_list.indexOf(dest);
if(addr_idx >= 0)
addr_list.splice(addr_idx, 1);
addr_list.unshift(dest);
if(addr_list.length > SentAddressHistoryLength)
addr_list.length = SentAddressHistoryLength;
userprops.set(props_sent, "address", addr_list);
userprops.set(props_sent, "localtime", new Date().toString());
return true;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment