From: Art Cancro Date: Mon, 14 Dec 1998 04:51:51 +0000 (+0000) Subject: Set up an option in output_headers() to optionally print the most X-Git-Tag: v7.86~8011 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=deebbd4a9e3c4bf8861873cfb932e3d7df0feb69;p=citadel.git Set up an option in output_headers() to optionally print the most often used opening HTML as well as the HTTP headers. --- diff --git a/webcit/ChangeLog b/webcit/ChangeLog index 8f95ed941..c27dd5e2f 100644 --- a/webcit/ChangeLog +++ b/webcit/ChangeLog @@ -9,6 +9,8 @@ Sun Dec 13 13:35:12 EST 1998 Art Cancro * messages.c: added "move message" functionality * userlist.c: added. This adds "userlist" and "show user" functions. * roomops.c: fixed buggy implementation of ungoto + * Set up an option in output_headers() to optionally print the most + often used opening HTML as well as the HTTP headers. Fri Dec 11 21:14:36 EST 1998 Art Cancro * Brought over message reading and entry functions from old WebCit diff --git a/webcit/auth.c b/webcit/auth.c index 9b8789134..b00144506 100644 --- a/webcit/auth.c +++ b/webcit/auth.c @@ -26,9 +26,7 @@ void display_login(char *mesg) { char buf[256]; printf("HTTP/1.0 200 OK\n"); - output_headers(); - - wprintf("\n"); + output_headers(1); /* Da banner */ wprintf("
\n"); @@ -147,8 +145,7 @@ void do_login(void) { void do_welcome(void) { printf("HTTP/1.0 200 OK\n"); - output_headers(); - wprintf("\n"); + output_headers(1); wprintf("

"); escputs(wc_username); wprintf("

\n"); @@ -175,11 +172,10 @@ void do_logout(void) { strcpy(wc_port, ""); printf("HTTP/1.0 200 OK\n"); - output_headers(); printf("X-WebCit-Session: close\n"); - - wprintf("Goodbye
\n"); + output_headers(1); + wprintf("
"); serv_puts("MESG goodbye"); serv_gets(buf); diff --git a/webcit/child.h b/webcit/child.h index e8e037681..105503777 100644 --- a/webcit/child.h +++ b/webcit/child.h @@ -27,7 +27,7 @@ void serv_printf(const char *format, ...); char *bstr(char *key); char *urlesc(char *); void urlescputs(char *); -void output_headers(void); +void output_headers(int); void wprintf(const char *format, ...); void extract(char *dest, char *source, int parmnum); int extract_int(char *source, int parmnum); diff --git a/webcit/mainmenu.c b/webcit/mainmenu.c index 98bc44527..44ae0cb8f 100644 --- a/webcit/mainmenu.c +++ b/webcit/mainmenu.c @@ -195,8 +195,7 @@ wprintf("
\n"); */ void display_main_menu(void) { printf("HTTP/1.0 200 OK\n"); - output_headers(); - wprintf("WebCit main menu\n"); + output_headers(1); embed_main_menu(); wprintf("\n"); wDumpContent(); @@ -205,8 +204,7 @@ void display_main_menu(void) { void display_advanced_menu(void) { printf("HTTP/1.0 200 OK\n"); - output_headers(); - wprintf("WebCit main menu\n"); + output_headers(1); embed_advanced_menu(); embed_main_menu(); wprintf("\n"); diff --git a/webcit/messages.c b/webcit/messages.c index b68c67cb7..9f767dae4 100644 --- a/webcit/messages.c +++ b/webcit/messages.c @@ -214,9 +214,7 @@ void readloop(char *oper) { int nummsgs; printf("HTTP/1.0 200 OK\n"); - output_headers(); - wprintf("Messages\n"); - wprintf("\n"); + output_headers(1); wprintf("
%s - ",wc_roomname); if (!strcmp(oper,"readnew")) { @@ -265,9 +263,7 @@ void post_message(void) { char buf[256]; printf("HTTP/1.0 200 OK\n"); - output_headers(); - wprintf(""); - wprintf("\n"); + output_headers(1); strcpy(buf, bstr("sc")); if (strcasecmp(buf, "Save message")) { @@ -329,9 +325,7 @@ void display_enter(void) { struct tm *tm; printf("HTTP/1.0 200 OK\n"); - output_headers(); - wprintf(""); - wprintf("\n"); + output_headers(1); sprintf(buf,"ENT0 0|%s|0|0",bstr("recp")); serv_puts(buf); @@ -396,9 +390,7 @@ void confirm_delete_msg(void) { msgid = atol(bstr("msgid")); printf("HTTP/1.0 200 OK\n"); - output_headers(); - wprintf(""); - wprintf("\n"); + output_headers(1); wprintf("
"); wprintf(""); - wprintf("\n"); + output_headers(1); if (!strcasecmp(bstr("yesno"), "Yes")) { sprintf(buf, "DELE %ld", msgid); @@ -462,9 +452,7 @@ void confirm_move_msg(void) { msgid = atol(bstr("msgid")); printf("HTTP/1.0 200 OK\n"); - output_headers(); - wprintf(""); - wprintf("\n"); + output_headers(1); wprintf("
"); wprintf(""); - wprintf("\n"); + output_headers(1); if (!strcasecmp(bstr("yesno"), "Move")) { sprintf(buf, "MOVE %ld|%s", msgid, bstr("target_room")); diff --git a/webcit/roomops.c b/webcit/roomops.c index 13d96c247..dbf694a41 100644 --- a/webcit/roomops.c +++ b/webcit/roomops.c @@ -116,8 +116,7 @@ void list_all_rooms_by_floor(void) { load_floorlist(); printf("HTTP/1.0 200 OK\n"); - output_headers(); - wprintf("List known rooms\n"); + output_headers(1); wprintf(""); wprintf(""); @@ -193,8 +192,7 @@ void gotoroom(char *gname, int display_name) printf("HTTP/1.0 200 OK\n"); - output_headers(); - wprintf("\n"); + output_headers(1); if (display_name != 2) { /* store ungoto information */ diff --git a/webcit/userlist.c b/webcit/userlist.c index abe0971ff..f5c5ac6c8 100644 --- a/webcit/userlist.c +++ b/webcit/userlist.c @@ -37,9 +37,7 @@ void userlist(void) { printf("HTTP/1.0 200 OK\n"); - output_headers(); - wprintf("User list\n"); - wprintf("\n"); + output_headers(1); serv_puts("LIST"); serv_gets(buf); @@ -106,9 +104,7 @@ void showuser(void) { int have_pic; printf("HTTP/1.0 200 OK\n"); - output_headers(); - wprintf("User profile\n"); - wprintf("\n"); + output_headers(1); wprintf("
FloorRooms with new messages
"); diff --git a/webcit/webcit.c b/webcit/webcit.c index c683e5082..ed680bc51 100644 --- a/webcit/webcit.c +++ b/webcit/webcit.c @@ -256,7 +256,7 @@ void getz(char *buf) { /* * Output all that important stuff that the browser will want to see */ -void output_headers(void) { +void output_headers(int print_standard_html_head) { static char *unset = "; expires=28-May-1971 18:10:00 GMT"; @@ -281,6 +281,14 @@ void output_headers(void) { if (strlen(wc_roomname)>0) printf("Set-cookie: wc_roomname=%s\n", wc_roomname); else printf("Set-cookie: wc_roomname=%s\n", unset); + + if (print_standard_html_head) { + wprintf(""); + escputs("WebCit"); + wprintf(""); + wprintf("\n"); + } + } void output_static(char *what) { @@ -293,7 +301,7 @@ void output_static(char *what) { fp = fopen(buf, "rb"); if (fp == NULL) { printf("HTTP/1.0 404 %s\n", strerror(errno)); - output_headers(); + output_headers(0); printf("Content-Type: text/plain\n"); sprintf(buf, "%s: %s\n", what, strerror(errno)); printf("Content-length: %d\n", strlen(buf)); @@ -302,7 +310,7 @@ void output_static(char *what) { } else { printf("HTTP/1.0 200 OK\n"); - output_headers(); + output_headers(0); if (!strncasecmp(&what[strlen(what)-4], ".gif", 4)) printf("Content-type: image/gif\n"); @@ -336,7 +344,7 @@ void output_image() { if (buf[0]=='2') { bytes = extract_long(&buf[4], 0); printf("HTTP/1.0 200 OK\n"); - output_headers(); + output_headers(0); printf("Content-type: image/gif\n"); printf("Content-length: %ld\n", bytes); printf("\n"); @@ -358,7 +366,7 @@ void output_image() { } else { printf("HTTP/1.0 404 %s\n", strerror(errno)); - output_headers(); + output_headers(0); printf("Content-Type: text/plain\n"); sprintf(buf, "Error retrieving image\n"); printf("Content-length: %d\n", strlen(buf)); @@ -606,9 +614,8 @@ fclose(fp); /* When all else fails... */ else { printf("HTTP/1.0 200 OK\n"); - output_headers(); + output_headers(1); - wprintf("WebCit\n"); wprintf("TransactionCount is %d
\n", TransactionCount); wprintf("You're in session %d
\n", wc_session); wprintf("Command:
\n");
diff --git a/webcit/who.c b/webcit/who.c
index 3ad6008c9..3b5de640d 100644
--- a/webcit/who.c
+++ b/webcit/who.c
@@ -31,13 +31,7 @@ void whobbs(void) {
 	int foundit;
 
         printf("HTTP/1.0 200 OK\n");
-        output_headers();
-        wprintf("Who is online?\n");
-
-	/* Uncomment this line to cause the wholist to auto-refresh */
-	/* wprintf("\n"); */
-
-	wprintf("\n");
+        output_headers(1);
 
         wprintf("
"); wprintf("Users currently on ");