From a1b04c57eca8827bf0ef3875265a6a356107091e Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Sat, 6 Jul 2002 03:10:26 +0000 Subject: [PATCH] * Enable a "make this my start page" link that works in lots of places. Configures a user's preference of where to go after login. --- webcit/ChangeLog | 5 ++- webcit/auth.c | 13 ++++++- webcit/mainmenu.c | 12 ++++--- webcit/roomops.c | 13 +++++-- webcit/static/mainframeset.html | 2 +- webcit/static/roombanner.html | 1 + webcit/webcit.c | 62 ++++++++++++++++++++++++++++++++- webcit/webcit.h | 5 ++- webcit/who.c | 4 ++- 9 files changed, 104 insertions(+), 13 deletions(-) diff --git a/webcit/ChangeLog b/webcit/ChangeLog index 3cccdd1f3..f52a864ef 100644 --- a/webcit/ChangeLog +++ b/webcit/ChangeLog @@ -1,4 +1,8 @@ $Log$ +Revision 323.43 2002/07/06 03:10:26 ajc +* Enable a "make this my start page" link that works in lots of places. + Configures a user's preference of where to go after login. + Revision 323.42 2002/06/19 22:01:31 ajc * When editing another user's vCard, do a "transient goto" to their config room so you don't automatically gain access to their config room. @@ -848,4 +852,3 @@ Sun Dec 6 19:50:55 EST 1998 Art Cancro 1998-12-03 Nathan Bryant * webserver.c: warning fix - diff --git a/webcit/auth.c b/webcit/auth.c index bb863faf1..c5c503bb4 100644 --- a/webcit/auth.c +++ b/webcit/auth.c @@ -148,7 +148,18 @@ void do_login(void) void do_welcome(void) { - http_redirect("/static/mainframeset.html"); + char startpage[SIZ]; + + get_preference("startpage", startpage); + if (strlen(startpage)==0) { + strcpy(startpage, "/dotskip&room=_BASEROOM_"); + set_preference("startpage", startpage); + } + + svprintf("STARTPAGE", WCS_STRING, startpage); + + do_template("mainframeset"); + clear_local_substs(); } diff --git a/webcit/mainmenu.c b/webcit/mainmenu.c index 655138698..fb903dbe0 100644 --- a/webcit/mainmenu.c +++ b/webcit/mainmenu.c @@ -33,11 +33,13 @@ void display_main_menu(void) { output_headers(1); - wprintf("
"); - wprintf("Basic commands\n"); - wprintf("
\n"); - wprintf("
"); + wprintf("
" + "
" + "Basic commands\n" + "
\n" + "
" + ); wprintf("\n" - "
"); /* start of first column */ diff --git a/webcit/roomops.c b/webcit/roomops.c index 8896b9499..104a5e791 100644 --- a/webcit/roomops.c +++ b/webcit/roomops.c @@ -369,6 +369,13 @@ void embed_room_banner(char *got) { got = fakegot; } + /* If the user happens to select the "make this my start page" link, + * we want it to remember the URL as a "/dotskip" one instead of + * a "skip" or "gotonext" or something like that. + */ + snprintf(WC->this_page, sizeof(WC->this_page), "/dotskip&room=%s", + WC->wc_roomname); + /* Check for new mail. */ WC->new_mail = extract_int(&got[4], 9); WC->wc_view = extract_int(&got[4], 11); @@ -380,6 +387,7 @@ void embed_room_banner(char *got) { svcallback("ROOMINFO", readinfo); svcallback("YOUHAVEMAIL", embed_newmail_button); svcallback("VIEWOMATIC", embed_view_o_matic); + svcallback("START", offer_start_page); do_template("roombanner"); clear_local_substs(); @@ -1820,8 +1828,9 @@ void knrooms() { ( !strcasecmp(listviewpref, "folders") ? "SELECTED" : "" ) ); - wprintf("

\n"); + wprintf("\n"); + offer_start_page(); + wprintf("
\n"); /* Display the room list in the user's preferred format */ if (!strcasecmp(listviewpref, "folders")) { diff --git a/webcit/static/mainframeset.html b/webcit/static/mainframeset.html index dcc4e18d7..4ed44ef6b 100644 --- a/webcit/static/mainframeset.html +++ b/webcit/static/mainframeset.html @@ -6,7 +6,7 @@ - + diff --git a/webcit/static/roombanner.html b/webcit/static/roombanner.html index 6a109574f..8f308b295 100644 --- a/webcit/static/roombanner.html +++ b/webcit/static/roombanner.html @@ -21,6 +21,7 @@
new of messages +
diff --git a/webcit/webcit.c b/webcit/webcit.c index c20a98b07..71df42eca 100644 --- a/webcit/webcit.c +++ b/webcit/webcit.c @@ -643,6 +643,55 @@ void blank_page(void) { } + + +/* + * Offer to make any page the user's "start page." + */ +void offer_start_page(void) { + wprintf("this_page); + wprintf("\">" + "Make this my start page" + "" + ); +} + + +/* + * Change the user's start page + */ +void change_start_page(void) { + + if (bstr("startpage") == NULL) { + display_error("startpage set to null"); + return; + } + + set_preference("startpage", bstr("startpage")); + + output_headers(3); + wprintf("
"); + wprintf("New start page\n"); + wprintf("
\n"); + + wprintf("
" + "Your start page has been changed." + "

\n" + "(Note: this does not change your browser's home page. " + "It changes the page you begin on when you log on to "); + escputs(serv_info.serv_humannode); + wprintf(".)

" + "Back..." + "
"); + + wDumpContent(1); +} + + + + void display_error(char *errormessage) { convenience_page("770000", "Error", errormessage); @@ -714,6 +763,8 @@ void upload_handler(char *name, char *filename, char *partnum, char *disp, } + + /* * Entry point for WebCit transaction */ @@ -809,8 +860,13 @@ void session_loop(struct httprequest *req) content = NULL; } + /* make a note of where we are in case the user wants to save it */ + safestrncpy(WC->this_page, cmd, sizeof(WC->this_page)); + remove_token(WC->this_page, 2, ' '); + remove_token(WC->this_page, 0, ' '); + /* If there are variables in the URL, we must grab them now */ - for (a = 0; a < strlen(cmd); ++a) + for (a = 0; a < strlen(cmd); ++a) { if ((cmd[a] == '?') || (cmd[a] == '&')) { for (b = a; b < strlen(cmd); ++b) if (isspace(cmd[b])) @@ -818,6 +874,8 @@ void session_loop(struct httprequest *req) addurls(&cmd[a + 1]); cmd[a] = 0; } + } + /* * If we're not connected to a Citadel server, try to hook up the * connection now. Preference is given to the host and port specified @@ -1066,6 +1124,8 @@ void session_loop(struct httprequest *req) folders(); } else if (!strcasecmp(action, "do_stuff_to_msgs")) { do_stuff_to_msgs(); + } else if (!strcasecmp(action, "change_start_page")) { + change_start_page(); } else if (!strcasecmp(action, "diagnostics")) { output_headers(1); diff --git a/webcit/webcit.h b/webcit/webcit.h index 0fcbdee32..38b079edf 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -144,7 +144,7 @@ struct wcsession { time_t lastreq; /* Timestamp of most recent HTTP */ int killthis; /* Nonzero == purge this session */ struct march *march; /* march mode room list */ - char reply_to[512]; /* reply-to address */ + char reply_to[SIZ]; /* reply-to address */ long msgarr[1024]; /* for read operations */ int fake_frames; int is_wap; /* Client is a WAP gateway */ @@ -152,6 +152,7 @@ struct wcsession { int HaveExpressMessages; /* Nonzero if incoming msgs exist */ struct wcsubst *vars; char *preferences; + char this_page[SIZ]; /* address of current page */ }; #define extract(dest,source,parmnum) extract_token(dest,source,parmnum,'|') @@ -311,3 +312,5 @@ void knrooms(void); int is_msg_in_mset(char *mset, long msgnum); char *safestrncpy(char *dest, const char *src, size_t n); void display_addressbook(long msgnum, char alpha); +void offer_start_page(void); +void change_start_page(void); diff --git a/webcit/who.c b/webcit/who.c index c2690f936..a1b2ca13b 100644 --- a/webcit/who.c +++ b/webcit/who.c @@ -47,7 +47,9 @@ void whobbs(void) wprintf("\""); wprintf("  Users currently on "); escputs(serv_info.serv_humannode); - wprintf("\n"); + wprintf(""); + offer_start_page(); + wprintf("\n"); wprintf("
\n\n"); wprintf("\n"); -- 2.39.2
Session ID