10 #include <sys/types.h>
12 #include <sys/socket.h>
15 #include <netinet/in.h>
37 char clientsoftware[256];
45 struct whouser *wlist = NULL;
46 struct whouser *wptr = NULL;
47 char buf[256], sess, user[256], room[256], host[256];
53 wprintf("<SCRIPT LANGUAGE=\"JavaScript\">\n"
54 "function ConfirmKill() { \n"
55 "return confirm('Do you really want to kill this session?');\n"
60 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=007700><TR><TD>");
61 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"<B>Users currently on ");
62 escputs(serv_info.serv_humannode);
63 wprintf("</B></FONT></TD></TR></TABLE>\n");
66 "Click on a name to read user info. Click on "
67 "<IMG SRC=\"/static/page.gif\" ALT=\"(p)\" BORDER=0> to send "
68 "a page (instant message) to that user.<BR>"
69 "<TABLE BORDER=1 WIDTH=100%%>\n<TR>\n");
70 wprintf("<TH>Session ID</TH>\n");
71 wprintf("<TH>User Name</TH>\n");
72 wprintf("<TH>Room</TH>");
73 wprintf("<TH>From host</TH>\n</TR>\n");
77 while (serv_gets(buf), strcmp(buf, "000")) {
78 sess = extract_int(buf, 0);
79 extract(user, buf, 1);
80 extract(room, buf, 2);
81 extract(host, buf, 3);
84 for (wptr = wlist; wptr != NULL; wptr = wptr->next) {
85 if (wptr->sessionnum == sess) {
87 if (strcasecmp(user, wptr->username)) {
88 sprintf(buf, "%cBR%c%s",
90 strcat(wptr->username, buf);
92 if (strcasecmp(room, wptr->roomname)) {
93 sprintf(buf, "%cBR%c%s",
95 strcat(wptr->roomname, buf);
97 if (strcasecmp(host, wptr->hostname)) {
98 sprintf(buf, "%cBR%c%s",
100 strcat(wptr->hostname, buf);
106 wptr = (struct whouser *)
107 malloc(sizeof(struct whouser));
110 strcpy(wlist->username, user);
111 strcpy(wlist->roomname, room);
112 strcpy(wlist->hostname, host);
113 wlist->sessionnum = sess;
117 while (wlist != NULL) {
118 wprintf("<TR>\n\t<TD ALIGN=center>%d", wlist->sessionnum);
120 (wlist->sessionnum != serv_info.serv_pid)) {
121 wprintf(" <A HREF=\"/terminate_session&which_session=%d&session_owner=", wlist->sessionnum);
122 urlescputs(wlist->username);
123 wprintf("\" onClick=\"return ConfirmKill();\" "
126 if (wlist->sessionnum == serv_info.serv_pid) {
127 wprintf(" <A HREF=\"/edit_me\" "
130 wprintf("</TD>\n\t<TD>");
133 /* username (link to user bio/photo page) */
134 wprintf("<A HREF=\"/showuser&who=");
135 urlescputs(wlist->username);
137 escputs(wlist->username);
140 /* (link to page this user) */
141 wprintf("<DIV ALIGN=RIGHT>"
142 "<A HREF=\"/whobbs\" "
143 " onClick=\"return window.open('/display_page&recp=");
144 urlescputs(wlist->username);
145 wprintf("', 'CitaPageWin', 'toolbar=no,location=no,copyhistory=no,status=no,scrollbars=yes,resizable=no,height=400,width=400');\">"
146 "<IMG SRC=\"/static/page.gif\" ALT=\"(p)\""
147 " BORDER=0></A></DIV>");
150 wprintf("</TD>\n\t<TD>");
151 escputs(wlist->roomname);
152 wprintf("</TD>\n\t<TD>");
154 escputs(wlist->hostname);
155 wprintf("</TD>\n</TR>");
161 wprintf("</TABLE></CENTER>\n");
166 void terminate_session(void)
170 serv_printf("TERM %s", bstr("which_session"));
177 * Change your session info (fake roomname and hostname)
183 if (!strcasecmp(bstr("sc"), "Change room name")) {
184 serv_printf("RCHG %s", bstr("fake_roomname"));
186 http_redirect("/whobbs");
187 } else if (!strcasecmp(bstr("sc"), "Change host name")) {
188 serv_printf("HCHG %s", bstr("fake_hostname"));
190 http_redirect("/whobbs");
191 } else if (!strcasecmp(bstr("sc"), "Change user name")) {
192 serv_printf("UCHG %s", bstr("fake_username"));
194 http_redirect("/whobbs");
195 } else if (!strcasecmp(bstr("sc"), "Cancel")) {
196 http_redirect("/whobbs");
201 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=000077><TR><TD>");
202 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"><B>");
203 wprintf("Edit your session display");
204 wprintf("</B></FONT></TD></TR></TABLE>\n");
205 wprintf("This screen allows you to change the way your\n");
206 wprintf("session appears in the 'Who is online' listing.\n");
207 wprintf("To turn off any 'fake' name you've previously\n");
208 wprintf("set, simply click the appropriate 'change' button\n");
209 wprintf("without typing anything in the corresponding box.\n");
212 wprintf("<FORM METHOD=\"POST\" ACTION=\"/edit_me\">\n");
214 wprintf("<TABLE border=0 width=100%%>\n");
216 wprintf("<TR><TD><B>Room name:</B></TD>\n<TD>");
217 wprintf("<INPUT TYPE=\"text\" NAME=\"fake_roomname\" MAXLENGTH=\"64\">\n");
218 wprintf("</TD>\n<TD ALIGN=center>");
219 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Change room name\">");
220 wprintf("</TD>\n</TR>\n");
222 wprintf("<TR><TD><B>Host name:</B></TD><TD>");
223 wprintf("<INPUT TYPE=\"text\" NAME=\"fake_hostname\" MAXLENGTH=\"64\">\n");
224 wprintf("</TD>\n<TD ALIGN=center>");
225 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Change host name\">");
226 wprintf("</TD>\n</TR>\n");
229 wprintf("<TR><TD><B>User name:</B></TD><TD>");
230 wprintf("<INPUT TYPE=\"text\" NAME=\"fake_username\" MAXLENGTH=\"64\">\n");
231 wprintf("</TD>\n<TD ALIGN=center>");
232 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Change user name\">");
233 wprintf("</TD>\n</TR>\n");
235 wprintf("<TR><TD> </TD><TD> </TD><TD ALIGN=center>");
236 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
237 wprintf("</TD></TR></TABLE>\n");
239 wprintf("</FORM></CENTER>\n");