4 * This module implements the RWHO (Read WHO's online) server command.
16 #include <sys/types.h>
24 #include "sysdep_decls.h"
25 #include "citserver.h"
29 #include "dynloader.h"
43 void cmd_rwho(char *argbuf) {
44 struct CitContext *cptr;
48 char real_room[ROOMNAMELEN], room[ROOMNAMELEN];
49 char host[40], flags[5];
51 aide = CC->usersupp.axlevel >= 6;
52 cprintf("%d%c \n", LISTING_FOLLOWS, CtdlCheckExpress() );
54 for (cptr = ContextList; cptr != NULL; cptr = cptr->next)
59 if (cptr->cs_flags & CS_POSTING)
64 if (cptr->fake_username[0])
66 strcpy(un, cptr->fake_username);
70 strcpy(un, cptr->curr_user);
72 if (cptr->fake_hostname[0])
74 strcpy(host, cptr->fake_hostname);
78 strcpy(host, cptr->cs_host);
80 GenerateRoomDisplay(real_room, cptr, CC);
82 if (cptr->fake_roomname[0]) {
83 strcpy(room, cptr->fake_roomname);
87 strcpy(room, real_room);
90 if ((aide) && (spoofed))
93 if ((cptr->cs_flags & CS_STEALTH) && (aide))
96 if (((cptr->cs_flags&CS_STEALTH)==0) || (aide))
98 cprintf("%d|%s|%s|%s|%s|%ld|%s|%s\n",
99 cptr->cs_pid, un, room,
100 host, cptr->cs_clientname,
101 (long)(cptr->lastidle),
102 cptr->lastcmdname, flags);
104 if ((spoofed) && (aide))
106 cprintf("%d|%s|%s|%s|%s|%ld|%s|%s\n",
107 cptr->cs_pid, cptr->curr_user,
109 cptr->cs_host, cptr->cs_clientname,
110 (long)(cptr->lastidle),
111 cptr->lastcmdname, flags);
116 /* Now it's magic time. Before we finish, call any EVT_RWHO hooks
117 * so that external paging modules such as serv_icq can add more
118 * content to the Wholist.
120 PerformSessionHooks(EVT_RWHO);
126 char *Dynamic_Module_Init(void)
128 CtdlRegisterProtoHook(cmd_rwho, "RWHO", "Display who is online");