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

Automatically exclude 0-aged users and blank genders from the output

of the user_age_and_gender() method.
Changed options.web_inactivity_timeout to just options.web_inactivity to be
more consistent with the existing modopts.ini [web] option naming.
parent 6ae79a48
No related branches found
No related tags found
No related merge requests found
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
// Library for reporting user presence (e.g. BBS node listings, who's online) // Library for reporting user presence (e.g. BBS node listings, who's online)
// Much of the code was derived from src/sbbs3/getnode.cpp: nodelist(), whos_online(), printnodedat() // Much of the code was derived from src/sbbs3/getnode.cpp: nodelist(), whos_online(), printnodedat()
require("nodedefs.js", 'NODE_INUSE');
require("text.js", 'UNKNOWN_USER'); require("text.js", 'UNKNOWN_USER');
require("nodedefs.js", 'NODE_INUSE');
require("sbbsdefs.js", 'USER_DELETED'); require("sbbsdefs.js", 'USER_DELETED');
"use strict"; "use strict";
...@@ -97,20 +97,20 @@ function user_age_and_gender(user, options) ...@@ -97,20 +97,20 @@ function user_age_and_gender(user, options)
{ {
var output = ''; var output = '';
if(options.include_age || options.include_gender) { if((options.include_age && user.age) || (options.include_gender && user.gender > ' ')) {
output += " ("; output += " (";
if(options.include_age) { if(options.include_age && user.age) {
if(options.age_prefix) if(options.age_prefix)
output += options.age_prefix; output += options.age_prefix;
output += user.age; output += user.age;
} }
if(options.include_gender) { if(options.include_gender && user.gender > ' ') {
if(options.gender_prefix) if(options.gender_prefix)
output += options.gender_prefix; output += options.gender_prefix;
var sep = options.gender_separator; var sep = options.gender_separator;
if(sep == undefined) if(sep == undefined)
sep = ' '; sep = ' ';
output += (options.include_age ? sep : '') + user.gender; output += ((options.include_age && user.age )? sep : '') + user.gender;
} }
if(options.status_prefix) if(options.status_prefix)
output += options.status_prefix; output += options.status_prefix;
...@@ -276,7 +276,7 @@ function web_users(max_inactivity, browsing) ...@@ -276,7 +276,7 @@ function web_users(max_inactivity, browsing)
// In addition to the options properties supported by node_status(), also supports: // In addition to the options properties supported by node_status(), also supports:
// options.format - a printf-style format for the node status line (e.g. "%d %s") // options.format - a printf-style format for the node status line (e.g. "%d %s")
// options.include_web_users - if false, don't include web users in output/result // options.include_web_users - if false, don't include web users in output/result
// options.web_inactivity_timeout - seconds before considering a web user offline // options.web_inactivity - seconds before considering a web user offline
// options.web_browsing - string to use to represent web actions (default: 'browsing') // options.web_browsing - string to use to represent web actions (default: 'browsing')
function nodelist(print, active, listself, is_sysop, options) function nodelist(print, active, listself, is_sysop, options)
{ {
...@@ -304,7 +304,7 @@ function nodelist(print, active, listself, is_sysop, options) ...@@ -304,7 +304,7 @@ function nodelist(print, active, listself, is_sysop, options)
output.push(line); output.push(line);
} }
if(options.include_web_users !== false) { if(options.include_web_users !== false) {
var web_user = web_users(options.web_inactivity_timeout, options.web_browsing); var web_user = web_users(options.web_inactivity, options.web_browsing);
for(var w in web_user) { for(var w in web_user) {
var line = format(options.format, ++n, web_user_status(web_user[w], options)); var line = format(options.format, ++n, web_user_status(web_user[w], options));
if(print) if(print)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment