]> code.citadel.org Git - citadel.git/blobdiff - webcit/paging.c
* Moved all diagnostic output to stderr
[citadel.git] / webcit / paging.c
index 1dbb3569b9d7736eb6a1097c2b9a326b57d1906a..553a872ff60b6d2a744bd3d8a3d6be692c3aa102 100644 (file)
@@ -1,31 +1,41 @@
 /* $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"
+
 
 /*
  * display the form for paging (x-messaging) another user
  */
-void display_page(void) {
+void display_page(void)
+{
        char buf[256];
        char user[256];
 
-        printf("HTTP/1.0 200 OK\n");
-        output_headers(1, "bottom");
+       output_headers(1);
 
-        wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=007700><TR><TD>");
-        wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
-        wprintf("<B>Page another user</B>\n");
-        wprintf("</FONT></TD></TR></TABLE>\n");
+       wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=007700><TR><TD>");
+       wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
+       wprintf("<B>Page another user</B>\n");
+       wprintf("</FONT></TD></TR></TABLE>\n");
 
        wprintf("This command sends a near-real-time message to any currently\n");
        wprintf("logged in user.<BR><BR>\n");
@@ -37,14 +47,14 @@ void display_page(void) {
        wprintf("<SELECT NAME=\"recp\" SIZE=10>\n");
        serv_puts("RWHO");
        serv_gets(buf);
-       if (buf[0]=='1') {
-               while(serv_gets(buf), strcmp(buf,"000")) {
-                       extract(user,buf,1);
+       if (buf[0] == '1') {
+               while (serv_gets(buf), strcmp(buf, "000")) {
+                       extract(user, buf, 1);
                        wprintf("<OPTION>");
                        escputs(user);
                        wprintf("\n");
-                       }
                }
+       }
        wprintf("</SELECT>\n");
        wprintf("<BR>\n");
 
@@ -56,61 +66,56 @@ void display_page(void) {
        wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\"><BR>\n");
 
        wprintf("</FORM></CENTER>\n");
-        wprintf("</BODY></HTML>\n");
-        wDumpContent();
-       }
+       wDumpContent(1);
+}
 
 /*
  * page another user
-*/
-void page_user(void) {
+ */
+void page_user(void)
+{
        char recp[256];
        char msgtext[256];
        char sc[256];
        char buf[256];
-       
-        printf("HTTP/1.0 200 OK\n");
-        output_headers(1, "bottom");
 
-       strcpy(recp,bstr("recp"));
-       strcpy(msgtext,bstr("msgtext"));
-       strcpy(sc,bstr("sc"));
+       output_headers(1);
 
-       if (strcmp(sc,"Send message")) {
-               wprintf("<EM>Message was not sent.</EM><BR>\n");
-               return;
-               }
+       strcpy(recp, bstr("recp"));
+       strcpy(msgtext, bstr("msgtext"));
+       strcpy(sc, bstr("sc"));
 
-       serv_printf("SEXP %s|%s",recp,msgtext);
-       serv_gets(buf); 
-
-       if (buf[0] == '2') {
-               wprintf("<EM>Message has been sent to ");
-               escputs(recp);
-               wprintf(".</EM><BR>\n");
-               }
-       else {
-               wprintf("<EM>%s</EM><BR>\n",&buf[4]);
+       if (strcmp(sc, "Send message")) {
+               wprintf("<EM>Message was not sent.</EM><BR>\n");
+       } else {
+               serv_printf("SEXP %s|%s", recp, msgtext);
+               serv_gets(buf);
+
+               if (buf[0] == '2') {
+                       wprintf("<EM>Message has been sent to ");
+                       escputs(recp);
+                       wprintf(".</EM><BR>\n");
+               } else {
+                       wprintf("<EM>%s</EM><BR>\n", &buf[4]);
                }
-
-        wprintf("</BODY></HTML>\n");
-        wDumpContent();
        }
+       wDumpContent(1);
+}
 
 
 
 /*
  * multiuser chat
  */
-void do_chat(void) {
+void do_chat(void)
+{
 
-        printf("HTTP/1.0 200 OK\n");
-        output_headers(1, "bottom");
+       output_headers(1);
 
-        wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=000077><TR><TD>");
-        wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
-        wprintf("<B>Real-time chat</B>\n");
-        wprintf("</FONT></TD></TR></TABLE>\n");
+       wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=000077><TR><TD>");
+       wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
+       wprintf("<B>Real-time chat</B>\n");
+       wprintf("</FONT></TD></TR></TABLE>\n");
 
        wprintf("A chat window should be appearing on your screen ");
        wprintf("momentarily.  When you're ");
@@ -119,11 +124,10 @@ void do_chat(void) {
 
        wprintf("<applet codebase=\"/static\" ");
        wprintf("code=\"wcchat\" width=2 height=2>\n");
-       wprintf("<PARAM NAME=username VALUE=\"%s\">\n", wc_username);
-       wprintf("<PARAM NAME=password VALUE=\"%s\">\n", wc_password);
+       wprintf("<PARAM NAME=username VALUE=\"%s\">\n", WC->wc_username);
+       wprintf("<PARAM NAME=password VALUE=\"%s\">\n", WC->wc_password);
        wprintf("<H2>Oops!</H2>Looks like your browser doesn't support Java, ");
        wprintf("so you won't be able to access Chat.  Sorry.\n");
        wprintf("</applet>\n");
-        wprintf("</BODY></HTML>\n");
-        wDumpContent();
-       }
+       wDumpContent(1);
+}