From 4d688600d21df7ba1f96e0752b72285325ef0c80 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Fri, 29 Jan 1999 19:51:23 +0000 Subject: [PATCH] * wDumpContent() is now responsible for most of the time (parameter settable) so that the main menu can easily be embedded in every page when running in noframes mode * noframes mode selection is now carried in the cookie --- webcit/ChangeLog | 6 ++++++ webcit/auth.c | 25 +++++++++++-------------- webcit/child.h | 2 +- webcit/context_loop.c | 2 +- webcit/cookie_conversion.c | 7 ++++--- webcit/graphics.c | 7 +++---- webcit/mainmenu.c | 12 ++++-------- webcit/messages.c | 23 +++++++---------------- webcit/netconf.c | 33 +++++++++++++-------------------- webcit/paging.c | 9 +++------ webcit/roomops.c | 36 +++++++++++++++--------------------- webcit/siteconfig.c | 4 ++-- webcit/sysmsgs.c | 10 +++++----- webcit/userlist.c | 6 ++---- webcit/webcit.c | 22 +++++++++++++++------- webcit/webcit.h | 4 ++-- webcit/who.c | 11 +++++------ 17 files changed, 99 insertions(+), 120 deletions(-) diff --git a/webcit/ChangeLog b/webcit/ChangeLog index 8e8315f7e..671181ee0 100644 --- a/webcit/ChangeLog +++ b/webcit/ChangeLog @@ -1,3 +1,9 @@ +Fri Jan 29 14:49:49 EST 1999 Art Cancro + * wDumpContent() is now responsible for most of the + time (parameter settable) so that the main menu can easily be + embedded in every page when running in noframes mode + * noframes mode selection is now carried in the cookie + Thu Jan 28 20:30:08 EST 1999 Art Cancro * Made the frames stuff less dependent on the HTML TARGET= directive and more dependent on the HTTP Window-target: directive. diff --git a/webcit/auth.c b/webcit/auth.c index 7a00800a0..24fc878f0 100644 --- a/webcit/auth.c +++ b/webcit/auth.c @@ -83,8 +83,7 @@ void display_login(char *mesg) { wprintf("and cookies.\n"); wprintf("\n"); - wprintf("\n"); - wDumpContent(); + wDumpContent(1); } @@ -187,8 +186,7 @@ void do_welcome(void) { wprintf("
"); embed_main_menu(); - wprintf("\n"); - wDumpContent(); + wDumpContent(1); } else { @@ -214,9 +212,8 @@ void do_logout(void) { if (buf[0]=='1') fmout(NULL); else wprintf("Goodbye\n"); - wprintf("
Log in again\n"); - wprintf("\n"); - wDumpContent(); + wprintf("
Log in again\n"); + wDumpContent(1); serv_puts("QUIT"); exit(0); } @@ -250,8 +247,8 @@ void validate(void) { serv_gets(buf); if (buf[0]!='3') { - wprintf("%s
\n", &buf[4]); - wDumpContent(); + wprintf("%s
\n", &buf[4]); + wDumpContent(1); return; } @@ -288,7 +285,7 @@ void validate(void) { urlesc(user), a, axdefs[a]); } wprintf("

\n"); - wDumpContent(); + wDumpContent(1); } @@ -355,8 +352,8 @@ void display_reg(int during_login) { } wprintf("\n"); wprintf("\n"); - wprintf("
\n"); - wDumpContent(); + wprintf("\n"); + wDumpContent(1); } /* @@ -424,8 +421,8 @@ void display_changepw(void) { wprintf("\n"); wprintf("\n"); wprintf("\n"); - wprintf("\n"); - wDumpContent(); + wprintf("\n"); + wDumpContent(1); } /* diff --git a/webcit/child.h b/webcit/child.h index 59eed7e42..b13d3fe87 100644 --- a/webcit/child.h +++ b/webcit/child.h @@ -21,7 +21,7 @@ void serv_gets(char *strbuf); void serv_puts(char *string); void whobbs(void); void fmout(FILE *fp); -void wDumpContent(void); +void wDumpContent(int); void serv_printf(const char *format, ...); char *bstr(char *key); char *urlesc(char *); diff --git a/webcit/context_loop.c b/webcit/context_loop.c index 705b3710c..cf76bca46 100644 --- a/webcit/context_loop.c +++ b/webcit/context_loop.c @@ -256,7 +256,7 @@ void *context_loop(int sock) { do { req_gets(sock, buf, hold); if (!strncasecmp(buf, "Cookie: webcit=", 15)) { - cookie_to_stuff(&buf[15], &desired_session, NULL, NULL, NULL); + cookie_to_stuff(&buf[15], &desired_session, NULL, NULL, NULL, NULL); } if (!strncasecmp(buf, "Content-length: ", 16)) { ContentLength = atoi(&buf[16]); diff --git a/webcit/cookie_conversion.c b/webcit/cookie_conversion.c index 2f11c211b..dd082849e 100644 --- a/webcit/cookie_conversion.c +++ b/webcit/cookie_conversion.c @@ -11,11 +11,11 @@ /* * Pack all session info into one easy-to-digest cookie. Healthy and delicious! */ -void stuff_to_cookie(char *cookie, int session, char *user, char *pass, char *room) { +void stuff_to_cookie(char *cookie, int session, char *user, char *pass, char *room, int nofr) { char buf[256]; int i; - sprintf(buf, "%d|%s|%s|%s", session, user, pass, room); + sprintf(buf, "%d|%s|%s|%s|%d", session, user, pass, room, nofr); strcpy(cookie, ""); for (i=0; i\n"); wprintf("\n"); wprintf("Cancel\n"); - wprintf("\n"); - wDumpContent(); + wprintf("\n"); + wDumpContent(1); } void do_graphics_upload(char *upl_cmd) { @@ -108,6 +108,5 @@ void select_floor_to_edit_pic(void) { wprintf("\n"); } - wprintf("\n"); - wDumpContent(); + wDumpContent(1); } diff --git a/webcit/mainmenu.c b/webcit/mainmenu.c index 7919b97bb..7ef6322d8 100644 --- a/webcit/mainmenu.c +++ b/webcit/mainmenu.c @@ -203,8 +203,7 @@ void display_main_menu(void) { printf("HTTP/1.0 200 OK\n"); output_headers(1, "bottom"); embed_main_menu(); - wprintf("\n"); - wDumpContent(); + wDumpContent(1); } @@ -213,8 +212,7 @@ void display_advanced_menu(void) { output_headers(1, "bottom"); embed_advanced_menu(); embed_main_menu(); - wprintf("\n"); - wDumpContent(); + wDumpContent(1); } @@ -247,8 +245,7 @@ void display_generic(void) { wprintf("
\n"); wprintf("\n"); - wprintf("\n"); - wDumpContent(); + wDumpContent(1); } void do_generic(void) { @@ -313,6 +310,5 @@ void do_generic(void) { wprintf("
"); wprintf("Enter another command
\n"); wprintf("Return to menu\n"); - wprintf("\n"); - wDumpContent(); + wDumpContent(1); } diff --git a/webcit/messages.c b/webcit/messages.c index ae57496ba..07ebc2be4 100644 --- a/webcit/messages.c +++ b/webcit/messages.c @@ -249,8 +249,7 @@ void readloop(char *oper) { read_message(msgarr[a], oper); } -DONE: wprintf("\n"); - wDumpContent(); +DONE: wDumpContent(1); } @@ -284,8 +283,7 @@ void post_message(void) { } } - wprintf("\n"); - wDumpContent(); + wDumpContent(1); } @@ -368,8 +366,7 @@ void display_enter(void) { wprintf("

\n"); wprintf("\n"); -DONE: wprintf("\n"); - wDumpContent(); +DONE: wDumpContent(1); } @@ -379,8 +376,6 @@ DONE: wprintf("\n"); - - /* * Confirm deletion of a message */ @@ -409,8 +404,7 @@ void confirm_delete_msg(void) { wprintf("\n"); wprintf("\n"); - wprintf("\n"); - wDumpContent(); + wDumpContent(1); } @@ -434,8 +428,7 @@ void delete_msg(void) { wprintf("Message not deleted.
\n"); } - wprintf("\n"); - wDumpContent(); + wDumpContent(1); } @@ -487,8 +480,7 @@ void confirm_move_msg(void) { wprintf("\n"); wprintf("\n"); - wprintf("\n"); - wDumpContent(); + wDumpContent(1); } @@ -512,7 +504,6 @@ void move_msg(void) { wprintf("Message not deleted.
\n"); } - wprintf("\n"); - wDumpContent(); + wDumpContent(1); } diff --git a/webcit/netconf.c b/webcit/netconf.c index a23a0bfd3..eaf0e9606 100644 --- a/webcit/netconf.c +++ b/webcit/netconf.c @@ -57,8 +57,7 @@ void display_edit_node(void) { wprintf("\n"); } - wprintf("


\n"); - wDumpContent(); + wDumpContent(1); } @@ -103,8 +102,7 @@ void display_netconf(void) { wprintf("\n"); } - wprintf("
\n"); - wDumpContent(); + wDumpContent(1); } @@ -131,8 +129,8 @@ void display_confirm_unshare(void) { wprintf("\">Yes   "); wprintf("No
\n"); - wDumpContent(); + wprintf("\">No
\n"); + wDumpContent(1); } @@ -154,8 +152,7 @@ void display_confirm_delete_node(void) { urlescputs(node); wprintf("\">Yes   "); wprintf("No
\n"); - wprintf("\n"); - wDumpContent(); + wDumpContent(1); } @@ -172,8 +169,7 @@ void delete_node(void) { output_headers(1, "bottom"); server_to_text(); wprintf("Back to menu\n"); - wprintf("\n"); - wDumpContent(); + wDumpContent(1); } else { display_error(&buf[4]); @@ -196,8 +192,7 @@ void unshare(void) { output_headers(1, "bottom"); server_to_text(); wprintf("Back to menu\n"); - wprintf("\n"); - wDumpContent(); + wDumpContent(1); } else { display_error(&buf[4]); @@ -224,8 +219,8 @@ void display_add_node(void) { wprintf(""); wprintf(""); - wprintf("\n"); - wDumpContent(); + wprintf("\n"); + wDumpContent(1); } @@ -247,8 +242,7 @@ void add_node(void) { output_headers(1, "bottom"); server_to_text(); wprintf("Back to menu\n"); - wprintf("\n"); - wDumpContent(); + wDumpContent(1); } else { display_error(&buf[4]); @@ -321,8 +315,8 @@ void display_share(void) { wprintf(""); wprintf(""); - wprintf("\n"); - wDumpContent(); + wprintf("\n"); + wDumpContent(1); /* free the list */ while (shlist != NULL) { @@ -354,8 +348,7 @@ void share(void) { output_headers(1, "bottom"); server_to_text(); wprintf("Back to menu\n"); - wprintf("\n"); - wDumpContent(); + wDumpContent(1); } else { display_error(&buf[4]); diff --git a/webcit/paging.c b/webcit/paging.c index 1dbb3569b..47a565435 100644 --- a/webcit/paging.c +++ b/webcit/paging.c @@ -56,8 +56,7 @@ void display_page(void) { wprintf("
\n"); wprintf("\n"); - wprintf("\n"); - wDumpContent(); + wDumpContent(1); } /* @@ -93,8 +92,7 @@ void page_user(void) { wprintf("%s
\n",&buf[4]); } - wprintf("\n"); - wDumpContent(); + wDumpContent(1); } @@ -124,6 +122,5 @@ void do_chat(void) { wprintf("

Oops!

Looks like your browser doesn't support Java, "); wprintf("so you won't be able to access Chat. Sorry.\n"); wprintf("\n"); - wprintf("\n"); - wDumpContent(); + wDumpContent(1); } diff --git a/webcit/roomops.c b/webcit/roomops.c index 7b1da7a04..7afc51959 100644 --- a/webcit/roomops.c +++ b/webcit/roomops.c @@ -254,8 +254,7 @@ void list_all_rooms_by_floor(void) { wprintf("\n"); } wprintf("\n"); - wprintf("\n"); - wDumpContent(); + wDumpContent(1); } @@ -272,8 +271,7 @@ void zapped_list(void) { listrms("LZRM -1"); wprintf("

\n"); wprintf("Click on any room to un-zap it and goto that room.\n"); - wprintf("\n"); - wDumpContent(); + wDumpContent(1); } @@ -333,8 +331,8 @@ void gotoroom(char *gname, int display_name) } if (buf[0]!='2') { if (display_name) { - wprintf("%s
\n",&buf[4]); - wDumpContent(); + wprintf("%s
\n",&buf[4]); + wDumpContent(1); } return; } @@ -390,10 +388,7 @@ void gotoroom(char *gname, int display_name) wprintf(""); wprintf("\n"); - if (noframes) embed_main_menu(); - - wprintf("\n"); - wDumpContent(); + wDumpContent(1); } strcpy(wc_roomname, wc_roomname); @@ -707,8 +702,7 @@ void display_editroom(void) { wprintf(""); wprintf("\n"); - wprintf("\n"); - wDumpContent(); + wDumpContent(1); } @@ -909,8 +903,8 @@ void display_entroom(void) { wprintf(""); wprintf(""); wprintf("\n"); - wprintf("\n"); - wDumpContent(); + wprintf("\n"); + wDumpContent(1); } @@ -988,8 +982,8 @@ void display_private(char *rname, int req_pass) wprintf(""); wprintf(""); - wprintf("\n"); - wDumpContent(); + wprintf("\n"); + wDumpContent(1); } /* @@ -1025,7 +1019,7 @@ void goto_private(void) { printf("HTTP/1.0 200 OK\n"); output_headers(1, "bottom"); wprintf("%s\n",&buf[4]); - wDumpContent(); + wDumpContent(1); return; } @@ -1049,8 +1043,8 @@ void display_zap(void) { wprintf("
\n"); wprintf(""); wprintf(""); - wprintf("
\n"); - wDumpContent(); + wprintf("\n"); + wDumpContent(1); } @@ -1115,8 +1109,8 @@ void confirm_delete_room(void) { wprintf(""); wprintf(""); - wprintf("\n"); - wDumpContent(); + wprintf("\n"); + wDumpContent(1); } diff --git a/webcit/siteconfig.c b/webcit/siteconfig.c index ab08bc85a..ce582e2c9 100644 --- a/webcit/siteconfig.c +++ b/webcit/siteconfig.c @@ -120,8 +120,8 @@ void display_siteconfig(void) { wprintf("
"); wprintf(""); wprintf("\n"); - wprintf("
\n"); - wDumpContent(); + wprintf("\n"); + wDumpContent(1); } diff --git a/webcit/sysmsgs.c b/webcit/sysmsgs.c index a9d735a01..7021ad16e 100644 --- a/webcit/sysmsgs.c +++ b/webcit/sysmsgs.c @@ -46,8 +46,8 @@ void display_edit(char *description, char *check_cmd, if (buf[0] == '1') server_to_text(); wprintf("

\n"); - wprintf("\n"); - wDumpContent(); + wprintf("\n"); + wDumpContent(1); } @@ -61,7 +61,7 @@ void save_edit(char *description, char *enter_cmd, int regoto) { printf("HTTP/1.0 200 OK\n"); output_headers(1, "bottom"); wprintf("Cancelled. %s was not saved.
\n", description); - wDumpContent(); + wDumpContent(1); return; } @@ -81,7 +81,7 @@ void save_edit(char *description, char *enter_cmd, int regoto) { else { printf("HTTP/1.0 200 OK\n"); output_headers(1, "bottom"); - wprintf("%s has been saved.\n", description); - wDumpContent(); + wprintf("%s has been saved.\n", description); + wDumpContent(1); } } diff --git a/webcit/userlist.c b/webcit/userlist.c index 8d60805ed..bfa2fc70c 100644 --- a/webcit/userlist.c +++ b/webcit/userlist.c @@ -90,8 +90,7 @@ void userlist(void) { } wprintf("\n"); -DONE: wprintf("\n"); - wDumpContent(); +DONE: wDumpContent(1); } @@ -133,6 +132,5 @@ void showuser(void) { serv_printf("RBIO %s",who); serv_gets(buf); if (buf[0]=='1') fmout(NULL); - wprintf("\n"); - wDumpContent(); + wDumpContent(1); } diff --git a/webcit/webcit.c b/webcit/webcit.c index 77ae51b6b..18c5f764e 100644 --- a/webcit/webcit.c +++ b/webcit/webcit.c @@ -178,9 +178,17 @@ int wContentLength(void) { return(len); } -void wDumpContent(void) { +void wDumpContent(int print_standard_html_footer) { struct webcontent *wptr; + if (print_standard_html_footer) { + if (noframes) { + wprintf("
"); + embed_main_menu(); + } + wprintf("\n"); + } + printf("Content-type: text/html\n"); printf("Content-length: %d\n", wContentLength()); printf("\n"); @@ -282,7 +290,8 @@ void output_headers(int print_standard_html_head, char *target) { printf("Cache-Control: no-store\n"); } - stuff_to_cookie(cookie, wc_session, wc_username, wc_password, wc_roomname); + stuff_to_cookie(cookie, wc_session, wc_username, wc_password, + wc_roomname, noframes); if (print_standard_html_head==2) { printf("X-WebCit-Session: close\n"); printf("Set-cookie: webcit=%s\n", unset); @@ -446,8 +455,7 @@ void convenience_page(char *titlebarcolor, char *titlebarmsg, char *messagetext) embed_main_menu(); } - wprintf("\n"); - wDumpContent(); + wDumpContent(1); } void display_error(char *errormessage) { @@ -535,7 +543,8 @@ void session_loop(void) { if (!strncasecmp(buf, "Cookie: webcit=", 15)) { strcpy(cookie, &buf[15]); cookie_to_stuff(cookie, NULL, - c_username, c_password, c_roomname); + c_username, c_password, c_roomname, + &noframes); } if (!strncasecmp(buf, "Content-length: ", 16)) { @@ -932,8 +941,7 @@ void session_loop(void) { wprintf("Variables:

\n");
 		dump_vars();
 		wprintf("

\n"); - wprintf("\n"); - wDumpContent(); + wDumpContent(1); } fflush(stdout); diff --git a/webcit/webcit.h b/webcit/webcit.h index c0aa1ba07..90fd99807 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -77,5 +77,5 @@ extern char *upload; extern char floorlist[128][256]; extern int noframes; -void stuff_to_cookie(char *, int, char *, char *, char *); -void cookie_to_stuff(char *, int *, char *, char *, char *); +void stuff_to_cookie(char *, int, char *, char *, char *, int); +void cookie_to_stuff(char *, int *, char *, char *, char *, int *); diff --git a/webcit/who.c b/webcit/who.c index 84e7d421c..03855e6d0 100644 --- a/webcit/who.c +++ b/webcit/who.c @@ -109,8 +109,8 @@ void whobbs(void) { } wprintf("\n"); wprintf("Refresh\n"); - wprintf("\n"); - wDumpContent(); + wprintf("\n"); + wDumpContent(1); } @@ -148,8 +148,7 @@ void terminate_session(void) { bstr("which_session")); wprintf("Yes   "); wprintf("No"); - wprintf("\n"); - wDumpContent(); + wDumpContent(1); } } @@ -225,8 +224,8 @@ void edit_me(void) { wprintf(""); wprintf("\n"); - wprintf("\n"); - wDumpContent(); + wprintf("\n"); + wDumpContent(1); } } -- 2.39.2