* Removed HTTP date fields because it was confusing browser caches (weird)
authorArt Cancro <ajc@citadel.org>
Mon, 8 May 2000 17:24:32 +0000 (17:24 +0000)
committerArt Cancro <ajc@citadel.org>
Mon, 8 May 2000 17:24:32 +0000 (17:24 +0000)
* Moved express messages to a pop-up HTML window (as opposed to a dialog box)

webcit/ChangeLog
webcit/paging.c
webcit/roomops.c
webcit/webcit.c
webcit/webcit.h

index 16a9f99e70303df7eebbefe146a7d597dbd2d085..4916c5aa5087628ab761afaccf94087bbe174285 100644 (file)
@@ -1,4 +1,8 @@
 $Log$
+Revision 211.18  2000/05/08 17:24:32  ajc
+* Removed HTTP date fields because it was confusing browser caches (weird)
+* Moved express messages to a pop-up HTML window (as opposed to a dialog box)
+
 Revision 211.17  2000/05/07 23:46:55  ajc
 * added Date: and Last-Modified: headers to HTTP output
 * masquerade room/host screen now runs in wholist window, and returns to it
@@ -435,4 +439,3 @@ Sun Dec  6 19:50:55 EST 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
 
 1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
        * webserver.c: warning fix
-
index df84373fd68d02a184abe8d72bb4255e0c05b709..ebe3a4e667d9cefaf25d2e1378c8373a135b2f41 100644 (file)
@@ -132,3 +132,39 @@ void do_chat(void)
        wprintf("</applet>\n");
        wDumpContent(1);
 }
+
+
+/*
+ *
+ */
+void page_popup(void)
+{
+       char buf[256];
+       char pagefrom[256];
+
+       /* suppress express message check, do headers but no fake frames */
+       output_headers(0x08 | 0x03);
+
+       while (serv_puts("GEXP"), serv_gets(buf), buf[0]=='1') {
+
+               extract(pagefrom, &buf[4], 3);
+
+               wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=007700><TR><TD>");
+               wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\""
+                       "<B>Express message from ");
+               escputs(pagefrom);
+               wprintf("</B></FONT></TD></TR></TABLE>\n");
+               
+               fmout(NULL);
+       }
+
+       wprintf("<CENTER>"
+               "<A HREF=\"javascript:window.close();\">"
+               "[ close window ]</A></B>\n"
+               "</CENTER>");
+
+       wDumpContent(1);
+       WC->HaveExpressMessages = 0;
+}
+
+
index e3d09be2311b893ad765b21ff926ff03bcd88993..5128f87cc4ba137020845a6c7baaf6bfc7824eaf 100644 (file)
@@ -1125,12 +1125,12 @@ void zap(void)
                serv_printf("GOTO %s", WC->wc_roomname);
                serv_gets(buf);
                if (buf[0] != '2') {
-                       ExpressMessageCat(&buf[4]);
+                       /* ExpressMessageCat(&buf[4]);   FIXME    */
                } else {
                        serv_puts("FORG");
                        serv_gets(buf);
                        if (buf[0] != '2') {
-                               ExpressMessageCat(&buf[4]);
+                               /* ExpressMessageCat(&buf[4]);  FIXME   */
                        } else {
                                strcpy(final_destination, "_BASEROOM_");
                        }
index 72da8375e86356ad457c45e97eccac94f0b449c4..e94bd49695ca83fc0b08b29cc735489b98e5426b 100644 (file)
@@ -283,16 +283,21 @@ void urlescputs(char *strbuf)
  * 3 = HTTP and HTML headers, but no 'fake frames'
  *
  * Bit 2: Set to 1 to auto-refresh page every 30 seconds
+ *
+ * Bit 3: suppress check for express messages
  */
 void output_headers(int controlcode)
 {
        char cookie[256];
        int print_standard_html_head = 0;
        int refresh30 = 0;
+       int suppress_check = 0;
        char httpnow[256];
+       static int pageseq = 0;
 
        print_standard_html_head        =       controlcode & 0x03;
        refresh30                       =       ((controlcode & 0x04) >> 2);
+       suppress_check                  =       ((controlcode & 0x08) >> 3);
 
        wprintf("HTTP/1.0 200 OK\n");
 
@@ -304,8 +309,6 @@ void output_headers(int controlcode)
                wprintf("Connection: close\n");
                wprintf("Pragma: no-cache\n");
                wprintf("Cache-Control: no-store\n");
-               wprintf("Date: %s\n"
-                       "Last-modified: %s\n", httpnow, httpnow);
        }
        stuff_to_cookie(cookie, WC->wc_session, WC->wc_username,
                        WC->wc_password, WC->wc_roomname);
@@ -325,30 +328,26 @@ void output_headers(int controlcode)
                if (refresh30) wprintf(
                        "<META HTTP-EQUIV=\"refresh\" CONTENT=\"30\">\n");
                wprintf("</HEAD>\n");
-               if (WC->ExpressMessages != NULL) {
-                       wprintf("<SCRIPT language=\"javascript\">\n");
-                       wprintf("function ExpressMessage() {\n");
-                       wprintf(" alert(\"");
-                       escputs(WC->ExpressMessages);
-                       wprintf("\")\n");
-                       wprintf(" }\n </SCRIPT>\n");
-               }
 
+               /* script for checking for express msgs (not always launch) */
+               wprintf("<SCRIPT LANGUAGE=\"JavaScript\">\n");
+               wprintf("function launch_page_popup() {\n");
+               wprintf("pwin = window.open('/page_popup', 'CitaPage%d', 'toolbar=no,location=no,copyhistory=no,status=yes,scrollbars=yes');\n");
+               wprintf("}\n");
+               wprintf("</SCRIPT>\n", ++pageseq);
+               /* end script */
 
-
-               /* JavaScript key-based navigation would go here if it
+               /* JavaScript keyboard-based navigation would go here if it
                 * were finished
                 */
 
                wprintf("<BODY ");
-               if (WC->ExpressMessages != NULL) {
-                       wprintf("onload=\"ExpressMessage()\" ");
-                       free(WC->ExpressMessages);
-                       WC->ExpressMessages = NULL;
+               if (!suppress_check) if (WC->HaveExpressMessages) {
+                       wprintf("onload=\"launch_page_popup()\" ");
+                       WC->HaveExpressMessages = 0;
                }
                wprintf("BACKGROUND=\"/image&name=background\" TEXT=\"#000000\" LINK=\"#004400\">\n");
-       
-       
+
        if (print_standard_html_head == 1) {
                wprintf("<A NAME=\"TheTop\"></A>"
                        "<TABLE border=0 width=100%>"
@@ -371,30 +370,13 @@ void output_headers(int controlcode)
 
 
 
-void ExpressMessageCat(char *buf) {
-       if (WC->ExpressMessages == NULL) {
-               WC->ExpressMessages = malloc(strlen(buf) + 4);
-               strcpy(WC->ExpressMessages, "");
-       } else {
-               WC->ExpressMessages = realloc(WC->ExpressMessages,
-                       (strlen(WC->ExpressMessages) + strlen(buf) + 4));
-       }
-       strcat(WC->ExpressMessages, buf);
-       strcat(WC->ExpressMessages, "\\n");
-}
-
-
 void check_for_express_messages()
 {
        char buf[256];
 
-       serv_puts("PEXP");
+       serv_puts("NOOP");
        serv_gets(buf);
-       if (buf[0] == '1') {
-               while (serv_gets(buf), strcmp(buf, "000")) {
-                       ExpressMessageCat(buf);
-               }
-       }
+       if (buf[3] == '*') WC->HaveExpressMessages = 1;
 }
 
 
@@ -403,7 +385,6 @@ void check_for_express_messages()
 void output_static(char *what)
 {
        char buf[4096];
-       char datebuf[256];
        long thisblock;
        FILE *fp;
        struct stat statbuf;
@@ -434,13 +415,6 @@ void output_static(char *what)
                bytes = statbuf.st_size;
                fprintf(stderr, "Static: %s, %ld bytes\n", what, bytes);
                wprintf("Content-length: %ld\n", (long) bytes);
-
-               httpdate(datebuf, time(NULL));
-               wprintf("Date: %s\n", datebuf);
-
-               httpdate(datebuf, statbuf.st_mtime);
-               wprintf("Last-modified: %s\n", datebuf);
-
                wprintf("\n");
                while (bytes > 0) {
                        thisblock = sizeof(buf);
@@ -714,6 +688,7 @@ void session_loop(struct httprequest *req)
                locate_host(browser_host, WC->http_sock);
                get_serv_info(browser_host, user_agent);
        }
+
        check_for_express_messages();
 
        /*
@@ -899,6 +874,8 @@ void session_loop(struct httprequest *req)
                edit_me();
        } else if (!strcasecmp(action, "display_siteconfig")) {
                display_siteconfig();
+       } else if (!strcasecmp(action, "page_popup")) {
+               page_popup();
        } else if (!strcasecmp(action, "siteconfig")) {
                siteconfig();
        } else if (!strcasecmp(action, "display_generic")) {
index 72873a1f0c28c410e4f90c8437da776c22b36683..3e77ef36d6cfd2528d2a5f21da0753895f6694c2 100644 (file)
@@ -124,8 +124,8 @@ struct wcsession {
        char reply_to[512];             /* reply-to address */
        long msgarr[1024];              /* for read operations */
        int fake_frames;
-       char *ExpressMessages;
        struct urlcontent *urlstrings;
+       int HaveExpressMessages;        /* Nonzero if incoming msgs exist */
 };
 
 
@@ -244,7 +244,6 @@ void do_generic(void);
 void display_menubar(int);
 void embed_room_banner(char *);
 void smart_goto(char *);
-void ExpressMessageCat(char *);
 void worker_entry(void);
 void session_loop(struct httprequest *);
 void mime_parser(char *content,
@@ -259,3 +258,4 @@ void mime_parser(char *content,
 void fmt_date(char *buf, time_t thetime);
 void httpdate(char *buf, time_t thetime);
 void end_webcit_session(void);
+void page_popup(void);