From 4f3b413f6fcbb510c06d04abc3aa2aaf9a596fd1 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Thu, 3 Jun 1999 16:29:57 +0000 Subject: [PATCH] * roomops.c: made room banner graphics more reliable * messages.c: added code to prevent accidental "double-posting" * who.c: fixed the "Change room/host/user" submit logic --- webcit/ChangeLog | 5 +++++ webcit/messages.c | 28 ++++++++++++++++++++++------ webcit/roomops.c | 2 +- webcit/who.c | 6 +++--- 4 files changed, 31 insertions(+), 10 deletions(-) diff --git a/webcit/ChangeLog b/webcit/ChangeLog index 75d8b7d42..3338d01bf 100644 --- a/webcit/ChangeLog +++ b/webcit/ChangeLog @@ -1,3 +1,8 @@ +Thu Jun 3 12:18:49 EDT 1999 Art Cancro + * roomops.c: made room banner graphics more reliable + * messages.c: added code to prevent accidental "double-posting" + * who.c: fixed the "Change room/host/user" submit logic + Thu Jun 2 09:48:00 EDT 1999 Nick Grossman * Changed static/menubar.html so the text is readable diff --git a/webcit/messages.c b/webcit/messages.c index 24f04c643..2c398b8e0 100644 --- a/webcit/messages.c +++ b/webcit/messages.c @@ -258,11 +258,20 @@ void readloop(char *oper) /* - * post message (or don't post message) + * Post message (or don't post message) + * + * Note regarding the "dont_post" variable: + * A random value (actually, it's just a timestamp) is inserted as a hidden + * field called "postseq" when the display_enter page is generated. This + * value is checked when posting, using the static variable dont_post. If a + * user attempts to post twice using the same dont_post value, the message is + * discarded. This prevents the accidental double-saving of the same message + * if the user happens to click the browser "back" button. */ void post_message(void) { char buf[256]; + static long dont_post = (-1L); printf("HTTP/1.0 200 OK\n"); output_headers(1); @@ -271,6 +280,9 @@ void post_message(void) strcpy(buf, bstr("sc")); if (strcasecmp(buf, "Save message")) { wprintf("Cancelled. Message was not posted.
\n"); + } else if (atol(bstr("postseq")) == dont_post) { + wprintf("Automatically cancelled because you have already " + "saved this message.
\n"); } else { sprintf(buf, "ENT0 1|%s|0|0", bstr("recp")); serv_puts(buf); @@ -279,6 +291,7 @@ void post_message(void) text_to_server(bstr("msgtext")); serv_puts("000"); wprintf("Message has been posted.
\n"); + dont_post = atol(bstr("postseq")); } else { wprintf("%s
\n", &buf[4]); } @@ -350,7 +363,7 @@ void display_enter(void) wprintf("formatting, indent a line at least one space. \n"); wprintf("
"); - time(&now); + now = time(NULL); tm = (struct tm *) localtime(&now); strcpy(buf, (char *) asctime(tm)); buf[strlen(buf) - 1] = 0; @@ -365,13 +378,16 @@ void display_enter(void) wprintf("
\n"); wprintf("\n", bstr("recp")); - wprintf(""); - wprintf("
\n"); + wprintf("\n", + now); + wprintf("" + "
\n"); - wprintf("

\n"); + wprintf("

\n"); wprintf("

\n"); - DONE:wDumpContent(1); +DONE: wDumpContent(1); wprintf(""); } diff --git a/webcit/roomops.c b/webcit/roomops.c index d4824a592..737197c3b 100644 --- a/webcit/roomops.c +++ b/webcit/roomops.c @@ -355,7 +355,7 @@ void embed_room_banner(char *got) { if (buf[0] == '2') { wprintf(""); wprintf(""); serv_puts("CLOS"); serv_gets(buf); diff --git a/webcit/who.c b/webcit/who.c index 371431869..2b8dd0155 100644 --- a/webcit/who.c +++ b/webcit/who.c @@ -183,9 +183,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 +199,9 @@ void edit_me(void) whobbs(); } else { + printf("HTTP/1.0 200 OK\n"); + output_headers(1); + wprintf("
"); wprintf(""); wprintf("Edit your session display"); -- 2.39.2