MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame^] | 1 | // MorgenGrauen MUDlib |
| 2 | // |
| 3 | // www.who.c |
| 4 | // |
| 5 | // $Id: www.who.c 8755 2014-04-26 13:13:40Z Zesstra $ |
| 6 | |
| 7 | #pragma strong_types |
| 8 | #pragma combine_strings |
| 9 | |
| 10 | #include <config.h> |
| 11 | #include <properties.h> |
| 12 | #include <www.h> |
| 13 | |
| 14 | string MakeLink(mixed entry) |
| 15 | { |
| 16 | string nm; |
| 17 | int idx; |
| 18 | |
| 19 | entry[1] = regreplace(entry[1], "<", "\\<", 1); |
| 20 | entry[1] = regreplace(entry[1], ">", "\\>", 1); |
| 21 | nm = getuid(entry[0]); |
| 22 | if(nm == " R O O T ") return "<TT>"+entry[1][0..2]+"</TT>"+entry[1][3..]; |
| 23 | idx = strstr(lower_case(entry[1]), nm); |
| 24 | return "<TT>"+entry[1][0..2]+"</TT>"+entry[1][3..idx-1] |
| 25 | + "<A HREF=\""+MUDWWW+"?"+REQ+"="+R_FINGER+"&"+USER+"="+nm+"\"><B>" |
| 26 | + entry[1][idx..idx = idx+sizeof(nm)] |
| 27 | + "</B></A>" |
| 28 | + entry[1][idx+1..]; |
| 29 | } |
| 30 | |
| 31 | string Request(mapping cmds) |
| 32 | { |
| 33 | string *who, *list; int i, s; |
| 34 | if (!sizeof(cmds)) return ERROR("Anfrage ungültig!"); |
| 35 | who = allocate(s = sizeof(list = WHO)); |
| 36 | for(i = s; i--; i > 0) |
| 37 | who[i] = MakeLink(list[s - i - 1]); |
| 38 | // who = map(WHO, #'MakeLink/*'*/); |
| 39 | return "<H2>Wer ist gerade in "MUDNAME"?</H2><HR>" |
| 40 | + "<OL><LI>"+implode(who, "\n<LI>")+"</OL>"; |
| 41 | } |