[Turn on line numbering]arg headers, info, args; var who, namel, names, times, idle, realm, x, cols, out, output, line; out = .build_header(headers, info, args, #[['title, "Connected Users"]]) + ["<center><h2>Connected users to <i>" + $motd.server_name() + "</i></h2></center></head><body><pre>"]; who = $user_db.connected(); names = who.mmap('hname); namel = []; for x in (who.mmap('name)) namel += [x.length()]; cols = namel.max() + 1; if (cols < 5) cols = 5; times = who.mmap('connected_time); cols = [cols, times.element_maxlength() + 1]; if (cols[2] < 7) cols = [cols[1], 7]; idle = who.mmap('idle_time); cols += [idle.element_maxlength() + 1]; if (cols[3] < 5) cols = cols.replace(3, 5); realm = who.mmap('realm_name, "text/html"); out += ["<hr size=1 noshade><b>" + "Name".pad(cols[1]) + " " + "On for".pad(cols[2]) + " " + "Idle".pad(cols[3]) + " Location", "----".pad(cols[1]) + " " + "------".pad(cols[2]) + " " + "----".pad(cols[3]) + " --------</b>"]; for x in [1 .. who.length()] { line = "<b>" + names[x] + "</b>" + "".pad(cols[1] - namel[x]) + " "; line = line + "<i>" + times[x] + "".pad(cols[2] - times[x].length()) + " "; line = line + idle[x] + "</i>" + "".pad(cols[3] - idle[x].length()) + " "; line += realm[x]; out += [line]; } out += ["</pre>"]; return [out + .build_footer(headers, info, args)];
// Brad Roberts
// Bruce Mitchener, Jr.
// Created 16-May-1997 as a part of ColdCore, see: @help Credit