From: Art Cancro Date: Mon, 8 May 2000 17:24:32 +0000 (+0000) Subject: * Removed HTTP date fields because it was confusing browser caches (weird) X-Git-Tag: v7.86~7202 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=f125458a206048a4c3fc9b8b061585eca9895fc8;p=citadel.git * 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) --- diff --git a/webcit/ChangeLog b/webcit/ChangeLog index 16a9f99e7..4916c5aa5 100644 --- a/webcit/ChangeLog +++ b/webcit/ChangeLog @@ -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 1998-12-03 Nathan Bryant * webserver.c: warning fix - diff --git a/webcit/paging.c b/webcit/paging.c index df84373fd..ebe3a4e66 100644 --- a/webcit/paging.c +++ b/webcit/paging.c @@ -132,3 +132,39 @@ void do_chat(void) wprintf("\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("
"); + wprintf("Express message from "); + escputs(pagefrom); + wprintf("
\n"); + + fmout(NULL); + } + + wprintf("
" + "" + "[ close window ]\n" + "
"); + + wDumpContent(1); + WC->HaveExpressMessages = 0; +} + + diff --git a/webcit/roomops.c b/webcit/roomops.c index e3d09be23..5128f87cc 100644 --- a/webcit/roomops.c +++ b/webcit/roomops.c @@ -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_"); } diff --git a/webcit/webcit.c b/webcit/webcit.c index 72da8375e..e94bd4969 100644 --- a/webcit/webcit.c +++ b/webcit/webcit.c @@ -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( "\n"); wprintf("\n"); - if (WC->ExpressMessages != NULL) { - wprintf("\n"); - } + /* script for checking for express msgs (not always launch) */ + wprintf("\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("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("" "" @@ -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")) { diff --git a/webcit/webcit.h b/webcit/webcit.h index 72873a1f0..3e77ef36d 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -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);