]> code.citadel.org Git - citadel.git/blobdiff - webcit/who.c
* Rewrote the HTTP engine and application coupling to run in a worker thread
[citadel.git] / webcit / who.c
index 2ae652dd4722cacab62ebdbc00104a3e83f0355e..8afc9d081470f0f214c856908ed0e8de29265b86 100644 (file)
@@ -1,16 +1,34 @@
 /* $Id$ */
 
+
+
+
+#include <ctype.h>
 #include <stdlib.h>
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 #include <stdio.h>
+#include <fcntl.h>
 #include <signal.h>
 #include <sys/types.h>
-#include <ctype.h>
+#include <sys/wait.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <limits.h>
+#include <netinet/in.h>
+#include <netdb.h>
 #include <string.h>
+#include <pwd.h>
+#include <errno.h>
+#include <stdarg.h>
+#include <pthread.h>
+#include <signal.h>
 #include "webcit.h"
-#include "child.h"
+
+
+
+
+
+
 
 struct whouser {
        struct whouser *next;
@@ -31,7 +49,7 @@ void whobbs(void)
        char buf[256], sess, user[256], room[256], host[256];
        int foundit;
 
-       printf("HTTP/1.0 200 OK\n");
+       wprintf("HTTP/1.0 200 OK\n");
        output_headers(1);
 
        wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=007700><TR><TD>");
@@ -89,7 +107,7 @@ void whobbs(void)
 
                while (wlist != NULL) {
                        wprintf("<TR>\n\t<TD ALIGN=center><FONT FACE=\"Arial,Helvetica,sans-serif\">%d", wlist->sessionnum);
-                       if ((is_aide) &&
+                       if ((WC->is_aide) &&
                            (wlist->sessionnum != serv_info.serv_pid)) {
                                wprintf(" <A HREF=\"/terminate_session&which_session=%d&session_owner=", wlist->sessionnum);
                                urlescputs(wlist->username);
@@ -116,7 +134,7 @@ void whobbs(void)
                                urlescputs(wlist->roomname);
                                wprintf("\" onMouseOver=\"window.status='Go to room ");
                                escputs(wlist->roomname);
-                               wprintf("'; return true\" TARGET=\"top\">");
+                               wprintf("'; return true\">");
                                escputs(wlist->roomname);
                                wprintf("</A>");
                        }
@@ -150,7 +168,7 @@ void terminate_session(void)
                        display_error(&buf[4]);
                }
        } else {
-               printf("HTTP/1.0 200 OK\n");
+               wprintf("HTTP/1.0 200 OK\n");
                output_headers(1);
                wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770000><TR><TD>");
                wprintf("<FONT FACE=\"Arial,Helvetica,sans-serif\" SIZE=+1 COLOR=\"FFFFFF\"<B>Confirm session termination");
@@ -183,9 +201,6 @@ void edit_me(void)
 {
        char buf[256];
 
-       printf("HTTP/1.0 200 OK\n");
-       output_headers(1);
-
        if (!strcasecmp(bstr("sc"), "Change room name")) {
                serv_printf("RCHG %s", bstr("fake_roomname"));
                serv_gets(buf);
@@ -202,6 +217,9 @@ void edit_me(void)
                whobbs();
        } else {
 
+               wprintf("HTTP/1.0 200 OK\n");
+               output_headers(1);
+
                wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=000077><TR><TD>");
                wprintf("<FONT FACE=\"Arial,Helvetica,sans-serif\" SIZE=+1 COLOR=\"FFFFFF\"><B>");
                wprintf("Edit your session display");
@@ -230,7 +248,7 @@ void edit_me(void)
                wprintf("<FONT FACE=\"Arial,Helvetica,sans-serif\"><INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Change host name\">");
                wprintf("</FONT></TD>\n</TR>\n");
 
-               if (is_aide) {
+               if (WC->is_aide) {
                        wprintf("<TR><TD><FONT FACE=\"Arial,Helvetica,sans-serif\"><B>User name:</B></FONT></TD><TD>");
                        wprintf("<FONT FACE=\"Arial,Helvetica,sans-serif\"><INPUT TYPE=\"text\" NAME=\"fake_username\" MAXLENGTH=\"64\">\n");
                        wprintf("</FONT></TD>\n<TD ALIGN=center>");