]> code.citadel.org Git - citadel.git/commitdiff
* roomops.c: made room banner graphics more reliable
authorArt Cancro <ajc@citadel.org>
Thu, 3 Jun 1999 16:29:57 +0000 (16:29 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 3 Jun 1999 16:29:57 +0000 (16:29 +0000)
        * messages.c: added code to prevent accidental "double-posting"
        * who.c: fixed the "Change room/host/user" submit logic

webcit/ChangeLog
webcit/messages.c
webcit/roomops.c
webcit/who.c

index 75d8b7d426881d1d3088ee7d15f6733e47a1b7a7..3338d01bf1628fcc433996324c1dcabc125db535 100644 (file)
@@ -1,3 +1,8 @@
+Thu Jun  3 12:18:49 EDT 1999 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
+       * 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 <nick@ulster.net>
        * Changed static/menubar.html so the text is readable
 
index 24f04c643b77e7d11e1527f3758372de3ff6df07..2c398b8e0cb71c9d88fc2da6ce2184ac0107402c 100644 (file)
@@ -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.<BR>\n");
+       } else if (atol(bstr("postseq")) == dont_post) {
+               wprintf("Automatically cancelled because you have already "
+                       "saved this message.<BR>\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.<BR>\n");
+                       dont_post = atol(bstr("postseq"));
                } else {
                        wprintf("<EM>%s</EM><BR>\n", &buf[4]);
                }
@@ -350,7 +363,7 @@ void display_enter(void)
        wprintf("formatting, indent a line at least one space.  \n");
        wprintf("<BR>");
 
-       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("<FORM METHOD=\"POST\" ACTION=\"/post\">\n");
        wprintf("<INPUT TYPE=\"hidden\" NAME=\"recp\" VALUE=\"%s\">\n",
                bstr("recp"));
-       wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Save message\">");
-       wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\"><BR>\n");
+       wprintf("<INPUT TYPE=\"hidden\" NAME=\"postseq\" VALUE=\"%ld\">\n",
+               now);
+       wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Save message\">"
+               "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\"><BR>\n");
 
-       wprintf("<TEXTAREA NAME=\"msgtext\" wrap=soft ROWS=30 COLS=80 WIDTH=80></TEXTAREA><P>\n");
+       wprintf("<TEXTAREA NAME=\"msgtext\" wrap=soft ROWS=30 COLS=80 "
+               "WIDTH=80></TEXTAREA><P>\n");
 
        wprintf("</FORM></CENTER>\n");
-      DONE:wDumpContent(1);
+DONE:  wDumpContent(1);
        wprintf("</FONT>");
 }
 
index d4824a592bf3d5adac06e37a0e0850539a3f4ab4..737197c3ba94d4370a2e67d55388c485d2b95b49 100644 (file)
@@ -355,7 +355,7 @@ void embed_room_banner(char *got) {
        if (buf[0] == '2') {
                wprintf("<TD><FONT FACE=\"Arial,Helvetica,sans-serif\">");
                wprintf("<IMG SRC=\"/image&name=_roompic_&room=");
-               escputs(wc_roomname);
+               urlescputs(wc_roomname);
                wprintf("\"></FONT></TD>");
                serv_puts("CLOS");
                serv_gets(buf);
index 3714318699f9bcb4061fd71f396092952ee2f7ca..2b8dd0155e945823abe45fbe0f8660fc0ea8f069 100644 (file)
@@ -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("<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");