blob: f8e5298df21b2cd8bd411689349eba00bd154127 [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001// MorgenGrauen MUDlib
2//
3// htmlwho.c
4//
5// $Id: htmlwho.c 8755 2014-04-26 13:13:40Z Zesstra $
6
7#pragma weak_types
8
9#include <udp.h>
10
11#define TJ(x) if (find_player("jof")) tell_object(find_player("jof"),x)
12
13string adjust(string str,int wid)
14{
Arathorn4aa91772025-07-26 22:31:25 +020015 string pattern = sprintf("%%|%ds", wid+sizeof(str));
16 return sprintf(pattern, str);
MG Mud User88f12472016-06-24 23:31:02 +020017}
18
Arathorn4aa91772025-07-26 22:31:25 +020019void udp_htmlwho(mapping data)
MG Mud User88f12472016-06-24 23:31:02 +020020{
21 int i,num;
Arathorn4aa91772025-07-26 22:31:25 +020022 string wholiste, tmp;
23 string* tmp2;
Arathorn6fa8c9e2020-08-05 13:29:02 +020024
Arathorn4aa91772025-07-26 22:31:25 +020025 <string|<object|string>* > * mdata="/obj/werliste"->QueryWhoListe(0,0,1);
Arathorn6fa8c9e2020-08-05 13:29:02 +020026
MG Mud User88f12472016-06-24 23:31:02 +020027 num=sizeof(mdata);
28 for (i=num-1;i>=0;i--)
29 {
30 tmp=mdata[i][0]->name();
31 if (tmp&&sizeof(tmp))
32 {
33 tmp2=explode(mdata[i][1],tmp);
34 if (sizeof(tmp2)>1)
35 {
36 tmp2[0]="<A HREF=\"/htbin/mudwww?finger?"+getuid(mdata[i][0])+"\"><b>";
37 tmp2[1]="</b></A>"+tmp2[1];
38 mdata[i][1]=implode(tmp2,tmp);
39 }
40 mdata[i]=" <LI> "+mdata[i][1];
41 }
42 }
43 wholiste=implode(mdata,"\n");
44 INETD->_send_udp(data[NAME], ([
45 REQUEST: REPLY,
46 RECIPIENT: data[SENDER],
47 ID: data[ID],
48 DATA: wholiste
49 ]) );
50}