int start, end;
char ench;
char urlbuf[256];
- char outbuf[256];
+ char outbuf[1024];
start = (-1);
end = strlen(buf);
sprintf(&outbuf[start], "%cA HREF=%c%s%c TARGET=%c%s%c%c%s%c/A%c",
LB, QU, urlbuf, QU, QU, TARGET, QU, RB, urlbuf, LB, RB);
strcat(outbuf, &buf[end]);
- strcpy(buf, outbuf);
+ if ( strlen(outbuf) < 250 )
+ strcpy(buf, outbuf);
}
return;
}
wprintf("<TABLE WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=000077><TR><TD>\n");
- wprintf("<FONT SIZE=+1 COLOR=\"FFFF00\"> ");
+ wprintf("<FONT FACE=\"Arial,Helvetica,sans-serif\" SIZE=+1 COLOR=\"FFFF00\"> ");
strcpy(m_subject, "");
strcpy(reply_to, "nobody...xxxxx");
&& (strcasecmp(&buf[5], serv_info.serv_humannode)))
wprintf("(%s) ", &buf[5]);
if ((!strncasecmp(buf, "room=", 5))
- && (strcasecmp(&buf[5], wc_roomname)))
+ && (strcasecmp(&buf[5], WC->wc_roomname)))
wprintf("in %s> ", &buf[5]);
if (!strncasecmp(buf, "node=", 5)) {
- if ((room_flags & QR_NETWORK)
+ if ((WC->room_flags & QR_NETWORK)
|| ((strcasecmp(&buf[5], serv_info.serv_nodename)
&& (strcasecmp(&buf[5], serv_info.serv_fqdn))))) {
wprintf("@%s ", &buf[5]);
wprintf("****");
wprintf("</FONT></TD>");
- if (is_room_aide) {
- wprintf("<TD ALIGN=RIGHT NOWRAP><FONT COLOR=\"FFFF00\"><B>");
+ if (WC->is_room_aide) {
+ wprintf("<TD ALIGN=RIGHT NOWRAP><FONT FACE=\"Arial,Helvetica,sans-serif\" COLOR=\"FFFF00\"><B>");
wprintf("<A HREF=\"/confirm_move_msg");
wprintf("&msgid=%ld", msgnum);
buf[strlen(buf) - 1] = 0;
if ((bq == 0) &&
((!strncmp(buf, ">", 1)) || (!strncmp(buf, " >", 2)) || (!strncmp(buf, " :-)", 4)))) {
- wprintf("<FONT COLOR=\"000044\"><I>");
+ wprintf("<FONT FACE=\"Arial,Helvetica,sans-serif\" COLOR=\"000044\"><I>");
bq = 1;
} else if ((bq == 1) &&
(strncmp(buf, ">", 1)) && (strncmp(buf, " >", 2)) && (strncmp(buf, " :-)", 4))) {
wprintf("</TT><BR>\n");
}
}
- wprintf("<BR>");
+ wprintf("</I><BR>");
}
printf("HTTP/1.0 200 OK\n");
output_headers(1);
- wprintf("<CENTER><B>%s - ", wc_roomname);
+ wprintf("<FONT FACE=\"Arial,Helvetica,sans-serif\"><CENTER><B>%s - ", WC->wc_roomname);
if (!strcmp(oper, "readnew")) {
strcpy(cmd, "MSGS NEW");
wprintf("new messages");
/*
- * 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);
+ wprintf("<FONT FACE=\"Arial,Helvetica,sans-serif\">");
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);
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]);
}
printf("HTTP/1.0 200 OK\n");
output_headers(1);
+ wprintf("<FACE=\"Arial,Helvetica,sans-serif\">");
+
sprintf(buf, "ENT0 0|%s|0|0", bstr("recp"));
serv_puts(buf);
serv_gets(buf);
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;
strcpy(&buf[16], &buf[19]);
wprintf("</CENTER><FONT COLOR=\"440000\"><B> %s ", &buf[4]);
- wprintf("from %s ", wc_username);
+ wprintf("from %s ", WC->wc_username);
if (strlen(bstr("recp")) > 0)
wprintf("to %s ", bstr("recp"));
- wprintf("in %s> ", wc_roomname);
+ wprintf("in %s> ", WC->wc_roomname);
wprintf("</B></FONT><BR><CENTER>\n");
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>");
}