[Turn off line numbering]1: arg headers, info, args; 2: var who, namel, names, times, idle, realm, x, cols, out, output, line; 3: 4: out = .build_header(headers, info, args, #[['title, "Connected Users"]]) + ["<center><h2>Connected users to <i>" + $motd.server_name() + "</i></h2></center></head><body><pre>"]; 5: who = $user_db.connected(); 6: names = who.mmap('hname); 7: namel = []; 8: for x in (who.mmap('name)) 9: namel += [x.length()]; 10: cols = namel.max() + 1; 11: if (cols < 5) 12: cols = 5; 13: times = who.mmap('connected_time); 14: cols = [cols, times.element_maxlength() + 1]; 15: if (cols[2] < 7) 16: cols = [cols[1], 7]; 17: idle = who.mmap('idle_time); 18: cols += [idle.element_maxlength() + 1]; 19: if (cols[3] < 5) 20: cols = cols.replace(3, 5); 21: realm = who.mmap('realm_name, "text/html"); 22: 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>"]; 23: for x in [1 .. who.length()] { 24: line = "<b>" + names[x] + "</b>" + "".pad(cols[1] - namel[x]) + " "; 25: line = line + "<i>" + times[x] + "".pad(cols[2] - times[x].length()) + " "; 26: line = line + idle[x] + "</i>" + "".pad(cols[3] - idle[x].length()) + " "; 27: line += realm[x]; 28: out += [line]; 29: } 30: out += ["</pre>"]; 31: return [out + .build_footer(headers, info, args)];
// Brad Roberts
// Bruce Mitchener, Jr.
// Created 16-May-1997 as a part of ColdCore, see: @help Credit