$Log$
+Revision 500.3 2003/06/21 05:17:21 ajc
+* Better alignment of system messages
+* Exterminated display_error() and replaced it with WC->ImportantMessage
+ which is displayed in a bubble on top of whatever page you're on next.
+* Small cosmetic changes
+* Fixed some nesting problems in output_headers()
+
Revision 500.2 2003/06/20 03:39:27 ajc
* Optimization to floor layout in box view
1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
* webserver.c: warning fix
+
if (WC->serv_sock >= 0) {
if (buf[0] == '1') {
- fmout(NULL);
+ fmout(NULL, "CENTER");
} else {
wprintf("Goodbye\n");
}
serv_puts("MESG changepw");
serv_gets(buf);
if (buf[0] == '1') {
- fmout(NULL);
+ fmout(NULL, "CENTER");
}
wprintf("<FORM ACTION=\"changepw\" METHOD=\"POST\">\n");
char newpass1[32], newpass2[32];
if (strcmp(bstr("action"), "Change")) {
- display_error("Cancelled. Password was not changed.");
+ strcpy(WC->ImportantMessage,
+ "Cancelled. Password was not changed.");
+ display_main_menu();
return;
}
strcpy(newpass1, bstr("newpass1"));
strcpy(newpass2, bstr("newpass2"));
if (strcasecmp(newpass1, newpass2)) {
- display_error("They don't match. Password was not changed.");
+ strcpy(WC->ImportantMessage,
+ "They don't match. Password was not changed.");
+ display_main_menu();
return;
}
serv_printf("SETP %s", newpass1);
serv_gets(buf);
- if (buf[0] == '2')
- display_success(&buf[4]);
- else
- display_error(&buf[4]);
+ strcpy(WC->ImportantMessage, &buf[4]);
+ display_main_menu();
}
serv_puts(check_cmd);
serv_gets(buf);
if (buf[0] != '2') {
- display_error(&buf[4]);
+ strcpy(WC->ImportantMessage, &buf[4]);
+ display_main_menu();
return;
}
output_headers(3);
int thisblock;
if (!strcasecmp(bstr("sc"), "Cancel")) {
+ strcpy(WC->ImportantMessage,
+ "Graphics upload cancelled.");
display_main_menu();
return;
}
if (WC->upload_length == 0) {
- display_error("You didn't upload a file.\n");
+ strcpy(WC->ImportantMessage,
+ "You didn't upload a file.");
+ display_main_menu();
return;
}
serv_puts(upl_cmd);
serv_gets(buf);
if (buf[0] != '2') {
- display_error(&buf[4]);
+ strcpy(WC->ImportantMessage, &buf[4]);
+ display_main_menu();
return;
}
bytes_remaining = WC->upload_length;
serv_printf("WRIT %d", thisblock);
serv_gets(buf);
if (buf[0] != '7') {
- display_error(&buf[4]);
+ strcpy(WC->ImportantMessage, &buf[4]);
serv_puts("UCLS 0");
serv_gets(buf);
+ display_main_menu();
return;
}
thisblock = extract_int(&buf[4], 0);
wprintf("<TD ALIGN=RIGHT>\n"
"<TABLE BORDER=0><TR>\n");
- wprintf("<TD BGCOLOR=\"#AAAADD\">"
- "<A HREF=\"/readfwd?startmsg=%ld", msgnum);
- wprintf("&maxmsgs=1&summary=0\">Read</A>"
- "</TD>\n", msgnum);
+ /*** "Read" button is now superfluous
+ ***
+ ***wprintf("<TD BGCOLOR=\"#AAAADD\">"
+ *** "<A HREF=\"/readfwd?startmsg=%ld", msgnum);
+ ***wprintf("&maxmsgs=1&summary=0\">Read</A>"
+ *** "</TD>\n", msgnum);
+ ***/
wprintf("<TD BGCOLOR=\"#AAAADD\">"
"<A HREF=\"/display_enter?recp=");
/* Messages in legacy Citadel variformat get handled thusly... */
if (!strcasecmp(mime_content_type, "text/x-citadel-variformat")) {
- fmout(NULL);
+ fmout(NULL, "JUSTIFY");
}
/* Boring old 80-column fixed format text gets handled this way... */
return;
}
- output_headers(1);
-
if (strcasecmp(bstr("sc"), "Save message")) {
- wprintf("Cancelled. Message was not posted.<BR>\n");
+ sprintf(WC->ImportantMessage,
+ "Cancelled. Message was not posted.");
} else if (atol(bstr("postseq")) == dont_post) {
- wprintf("Automatically cancelled because you have already "
- "saved this message.<BR>\n");
+ sprintf(WC->ImportantMessage,
+ "Automatically cancelled because you have already "
+ "saved this message.");
} else {
sprintf(buf, "ENT0 1|%s|0|4|%s",
bstr("recp"),
serv_gets(buf);
if (buf[0] == '4') {
post_mime_to_server();
- wprintf("Message has been posted.<BR>\n");
+ sprintf(WC->ImportantMessage,
+ "Message has been posted.\n");
dont_post = atol(bstr("postseq"));
} else {
- wprintf("<EM>%s</EM><BR>\n", &buf[4]);
+ sprintf(WC->ImportantMessage,
+ "%s", &buf[4]);
}
}
- wDumpContent(1);
free_attachments(WC);
+ readloop("readnew");
}
wprintf("<A HREF=\"/display_netconf\">Back to menu</A>\n");
wDumpContent(1);
} else {
- display_error(&buf[4]);
+ strcpy(WC->ImportantMessage, &buf[4]);
+ display_netconf();
}
}
}
escputs(pagefrom);
wprintf("</SPAN></TD></TR></TABLE>\n");
- fmout(NULL);
+ fmout(NULL, "LEFT");
}
wprintf("<CENTER>");
serv_puts("RINF");
serv_gets(buf);
if (buf[0] == '1') {
- fmout(NULL);
+ fmout(NULL, "CENTER");
}
}
serv_gets(buf);
if (buf[0] != '2') {
- display_error(&buf[4]);
+ strcpy(WC->ImportantMessage, &buf[4]);
+ display_main_menu();
return;
}
extract(er_name, &buf[4], 0);
if (strcmp(bstr("sc"), "OK")) {
- display_error("Cancelled. Changes were not saved.");
+ strcpy(WC->ImportantMessage,
+ "Cancelled. Changes were not saved.");
+ display_main_menu();
return;
}
serv_puts("GETR");
serv_gets(buf);
if (buf[0] != '2') {
- display_error(&buf[4]);
+ strcpy(WC->ImportantMessage, &buf[4]);
+ display_main_menu();
return;
}
extract(er_name, &buf[4], 0);
serv_puts(buf);
serv_gets(buf);
if (buf[0] != '2') {
- display_error(&buf[4]);
+ strcpy(WC->ImportantMessage, &buf[4]);
+ display_main_menu();
return;
}
gotoroom(er_name, 0);
serv_puts(buf);
serv_gets(buf);
if (buf[0] != '2') {
- display_error(&buf[4]);
+ strcpy(WC->ImportantMessage, &buf[4]);
+ display_main_menu();
return;
}
}
serv_gets(buf);
if (buf[0] != '2') {
- display_error(&buf[4]);
- return;
+ strcpy(WC->ImportantMessage, &buf[4]);
+ display_main_menu();
+ return;
}
extract(room, &buf[4], 0);
strcpy(username, bstr("username"));
- output_headers(1);
- stresc(buf, WC->wc_roomname, 1);
- svprintf("BOXTITLE", WCS_STRING, "Access control list for %s", buf);
- do_template("beginbox");
-
if(!strcmp(bstr("sc"), "Kick")) {
sprintf(buf, "KICK %s", username);
serv_puts(buf);
serv_gets(buf);
if (buf[0] != '2') {
- display_error(&buf[4]);
- return;
+ strcpy(WC->ImportantMessage, &buf[4]);
} else {
- wprintf("<B><I>User %s kicked out of room %s.</I></B>\n",
+ sprintf(WC->ImportantMessage,
+ "<B><I>User %s kicked out of room %s.</I></B>\n",
username, room);
}
} else if(!strcmp(bstr("sc"), "Invite")) {
serv_gets(buf);
if (buf[0] != '2') {
- display_error(&buf[4]);
- return;
+ strcpy(WC->ImportantMessage, &buf[4]);
} else {
- wprintf("<B><I>User %s invited to room %s.</I></B>\n",
+ sprintf(WC->ImportantMessage,
+ "<B><I>User %s invited to room %s.</I></B>\n",
username, room);
}
}
-
+ output_headers(1);
+ stresc(buf, WC->wc_roomname, 1);
+ svprintf("BOXTITLE", WCS_STRING, "Access control list for %s", buf);
+ do_template("beginbox");
wprintf("<TABLE border=0 CELLSPACING=10><TR VALIGN=TOP>"
"<TD>The users listed below have access to this room. "
serv_gets(buf);
if (buf[0] != '2') {
- display_error(&buf[4]);
+ strcpy(WC->ImportantMessage, &buf[4]);
+ display_main_menu();
return;
}
output_headers(3);
serv_printf("MESG roomaccess");
serv_gets(buf);
if (buf[0] == '1') {
- fmout(NULL);
+ fmout(NULL, "CENTER");
}
do_template("endbox");
wDumpContent(1);
int er_num_type;
if (strcmp(bstr("sc"), "OK")) {
- display_error("Cancelled. No new room was created.");
+ strcpy(WC->ImportantMessage,
+ "Cancelled. No new room was created.");
+ display_main_menu();
return;
}
strcpy(er_name, bstr("er_name"));
serv_puts(buf);
serv_gets(buf);
if (buf[0] != '2') {
- display_error(&buf[4]);
+ strcpy(WC->ImportantMessage, &buf[4]);
+ display_main_menu();
return;
}
smart_goto(er_name);
serv_puts("KILL 0");
serv_gets(buf);
if (buf[0] != '2') {
- display_error(&buf[4]);
+ strcpy(WC->ImportantMessage, &buf[4]);
+ display_main_menu();
return;
}
output_headers(1);
strcpy(sc, bstr("sc"));
if (strcasecmp(sc, "Delete")) {
- display_error("Cancelled. This room was not deleted.");
+ strcpy(WC->ImportantMessage,
+ "Cancelled. This room was not deleted.");
+ display_main_menu();
return;
}
serv_puts("KILL 1");
serv_gets(buf);
if (buf[0] != '2') {
- display_error(&buf[4]);
+ strcpy(WC->ImportantMessage, &buf[4]);
+ display_main_menu();
+ return;
} else {
smart_goto("_BASEROOM_");
}
* If fp is non-null, it is considered to be the file handle to read the
* text from. Otherwise, text is read from the server.
*/
-void fmout(FILE * fp)
+void fmout(FILE *fp, char *align)
{
int intext = 0;
int bq = 0;
char buf[SIZ];
- wprintf("<DIV ALIGN=JUSTIFY>\n");
+ wprintf("<DIV ALIGN=%s>\n", align);
while (1) {
if (fp == NULL)
serv_gets(buf);
serv_printf("CONF set");
serv_gets(buf);
if (buf[0] != '4') {
- display_error(&buf[4]);
+ strcpy(WC->ImportantMessage, &buf[4]);
+ display_main_menu();
return;
}
serv_printf("%s", bstr("c_nodename"));
<TABLE border=0>
<TR>
<td align=center>
- <p><?HELLO></p>
+ <?HELLO>
<form action="/login" method="POST">
<table border="0" cellspacing="5" cellpadding="5" BGCOLOR="#EEEEEE">
a:link {
- color: #FF0000;
+ color: #0000FF;
text-decoration: none;
}
a:visited {
- color: #800080;
+ color: #0000FF;
text-decoration: none;
}
a:active {
- color: #00FF00;
+ color: #0000FF;
text-decoration: none;
}
background: none
}
-.example { margin-left: 10% }
-
dfn {
font-style: normal;
font-weight: bolder
wprintf("%s\n", &buf[4]);
break;
case '1':
- fmout(NULL);
+ fmout(NULL, "CENTER");
break;
case '4':
wprintf("%s\n", &buf[4]);
serv_gets(buf);
if (buf[0] != '2') {
- display_error(&buf[4]);
+ strcpy(WC->ImportantMessage, &buf[4]);
+ display_main_menu();
return;
}
output_headers(headers_type);
char buf[SIZ];
if (strcmp(bstr("sc"), "Save")) {
- output_headers(1);
- wprintf("Cancelled. %s was not saved.<BR>\n", description);
- wDumpContent(1);
+ sprintf(WC->ImportantMessage,
+ "Cancelled. %s was not saved.\n", description);
+ display_main_menu();
return;
}
serv_puts(enter_cmd);
serv_gets(buf);
if (buf[0] != '4') {
- display_error(&buf[4]);
+ strcpy(WC->ImportantMessage, &buf[4]);
+ display_main_menu();
return;
}
text_to_server(bstr("msgtext"), 0);
if (regoto) {
smart_goto(WC->wc_roomname);
} else {
- output_headers(1);
- wprintf("%s has been saved.\n", description);
- wDumpContent(1);
+ sprintf(WC->ImportantMessage,
+ "%s has been saved.\n", description);
+ display_main_menu();
+ return;
}
}
serv_printf("RBIO %s", who);
serv_gets(buf);
if (buf[0] == '1') {
- fmout(NULL);
+ fmout(NULL, "JUSTIFY");
}
wprintf("<BR><A HREF=\"/display_page&recp=");
urlescputs(who);
"Cache-Control: no-store\n"
);
}
+
stuff_to_cookie(cookie, WC->wc_session, WC->wc_username,
WC->wc_password, WC->wc_roomname);
+
if (print_standard_html_head == 2) {
wprintf("Set-cookie: webcit=%s\n", unset);
} else {
do_template("background");
clear_local_substs();
+ }
if (print_standard_html_head == 1) {
wprintf("<A NAME=\"TheTop\"></A>");
-
embed_room_banner(NULL);
-
- }
}
+
+ if (strlen(WC->ImportantMessage) > 0) {
+ do_template("beginbox_nt");
+ wprintf("<SPAN CLASS=\"errormsg\">"
+ "%s</SPAN><BR>\n", WC->ImportantMessage);
+ do_template("endbox");
+ strcpy(WC->ImportantMessage, "");
+ }
}
void change_start_page(void) {
if (bstr("startpage") == NULL) {
- display_error("startpage set to null");
+ strcpy(WC->ImportantMessage,
+ "startpage set to null");
+ display_main_menu();
return;
}
-void display_error(char *errormessage)
-{
- convenience_page("770000", "Error", errormessage);
-}
-
void display_success(char *successmessage)
{
convenience_page("007700", "OK", successmessage);
{
struct urlcontent *u;
- lprintf(5, "Upload handler called: %s, %ld bytes\n",
- cbtype, (long)length);
-
/* Form fields */
if ( (length > 0) && (strlen(cbtype) == 0) ) {
u = (struct urlcontent *) malloc(sizeof(struct urlcontent));
memcpy(WC->upload, content, length);
}
else {
- lprintf(9, "malloc() failed: %s\n",
- strerror(errno));
+ lprintf(3, "malloc() failed: %s\n", strerror(errno));
}
}
c_username, c_password, c_roomname);
}
else if (!strncasecmp(buf, "Content-length: ", 16)) {
- lprintf(9, "%s\n", buf);
ContentLength = atoi(&buf[16]);
}
else if (!strncasecmp(buf, "Content-type: ", 14)) {
- lprintf(9, "%s\n", buf);
safestrncpy(ContentType, &buf[14], sizeof ContentType);
}
else if (!strncasecmp(buf, "User-agent: ", 12)) {
addurls(&content[body_start]);
} else if (!strncasecmp(ContentType, "multipart", 9)) {
content_end = content + ContentLength + body_start;
- lprintf(9, "Calling MIME parser\n");
mime_parser(content, content_end, *upload_handler,
NULL, NULL, NULL, 0);
}
int num_cal;
#endif
struct wc_attachment *first_attachment;
+ char ImportantMessage[SIZ];
};
#define extract(dest,source,parmnum) extract_token(dest,source,parmnum,'|')
void serv_gets(char *strbuf);
void serv_puts(char *string);
void whobbs(void);
-void fmout(FILE * fp);
+void fmout(FILE *fp, char *align);
void wDumpContent(int);
void serv_printf(const char *format,...);
char *bstr(char *key);
void zapped_list(void);
void display_zap(void);
void zap(void);
-void display_error(char *);
void display_success(char *);
void display_entroom(void);
void entroom(void);