diff --git a/exec/load/sbbslist_lib.js b/exec/load/sbbslist_lib.js index d0c2f10f7251b8d8f2ce54c2aa4b631c50136cea..ece44ec709f1ba2c2c9c18941045eb9ca3d09b1f 100644 --- a/exec/load/sbbslist_lib.js +++ b/exec/load/sbbslist_lib.js @@ -508,6 +508,39 @@ function remove_dupes(list) return new_list; } +function remove_inactive(list, max, verbose) +{ + var new_list=[]; + var i; + + for(i in list) { + var bbs = list[i]; + var updated = 0; + if(bbs.entry.updated) + updated = new Date(bbs.entry.updated.on); + var created = 0; + if(bbs.entry.created) + created = new Date(bbs.entry.created.on); + if(created > updated) + updated = created; + var verified = 0; + if(bbs.entry.verified) + verified = new Date(bbs.entry.verified.on); + if(verified > updated) + updated = verified; + var diff = new Date().valueOf() - updated.valueOf(); + var days = diff / (24 * 60 * 60 * 1000); + if(days > max) { + if(verbose) + print(format("%-25s : Inactive since %.10s (%d days)" + , bbs.name, updated.toISOString(), days)); + continue; + } + new_list.push(list[i]); + } + return new_list; +} + function imsg_capable_system(bbs) { if(bbs.imsg_capable == true)