From c88e9aedf6f1934ace406d0c915aca21bf88eb10 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Wed, 19 Jun 2002 21:42:58 +0000 Subject: [PATCH] * Added support for "transient goto" which allows entry into a private and/or zapped room without putting the room [back] on your known rooms list. This is useful for the new administrative functions in WebCit (updating a user's vCard without the Aide suddenly having that user's config room on their list). It's also useful for making a certain pedophile in Sacramento even more suspicious that someone is reading his email. --- citadel/ChangeLog | 9 +++++++++ citadel/imap_misc.c | 4 ++-- citadel/room_ops.c | 20 +++++++++++++------- citadel/room_ops.h | 3 ++- citadel/serv_imap.c | 18 +++++++++--------- citadel/techdoc/session.txt | 6 ++++++ citadel/user_ops.c | 4 ++-- 7 files changed, 43 insertions(+), 21 deletions(-) diff --git a/citadel/ChangeLog b/citadel/ChangeLog index 602467082..31d06d7a5 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,12 @@ $Log$ + Revision 591.48 2002/06/19 21:42:57 ajc + * Added support for "transient goto" which allows entry into a private and/or + zapped room without putting the room [back] on your known rooms list. This + is useful for the new administrative functions in WebCit (updating a user's + vCard without the Aide suddenly having that user's config room on their + list). It's also useful for making a certain pedophile in Sacramento even + more suspicious that someone is reading his email. + Revision 591.47 2002/06/18 16:34:06 error * room_ops.c: Fix for old room record not being deleted when renaming baseroom or aideroom @@ -3743,3 +3751,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import + diff --git a/citadel/imap_misc.c b/citadel/imap_misc.c index a90f203ac..6878fea5d 100644 --- a/citadel/imap_misc.c +++ b/citadel/imap_misc.c @@ -285,7 +285,7 @@ void imap_append(int num_parms, char *parms[]) { if (IMAP->selected) { strcpy(savedroom, CC->quickroom.QRname); } - usergoto(roomname, 0, &msgs, &new); + usergoto(roomname, 0, 0, &msgs, &new); /* * Can we post here? @@ -312,7 +312,7 @@ void imap_append(int num_parms, char *parms[]) { * our happy day without violent explosions. */ if (IMAP->selected) { - usergoto(savedroom, 0, &msgs, &new); + usergoto(savedroom, 0, 0, &msgs, &new); } /* We don't need this buffer anymore */ diff --git a/citadel/room_ops.c b/citadel/room_ops.c index 8d83038c6..3a3f32b5c 100644 --- a/citadel/room_ops.c +++ b/citadel/room_ops.c @@ -689,7 +689,8 @@ void cmd_lzrm(char *argbuf) * or access control is done here -- the caller should make sure that the * specified room exists and is ok to access. */ -void usergoto(char *where, int display_result, int *retmsgs, int *retnew) +void usergoto(char *where, int display_result, int transiently, + int *retmsgs, int *retnew) { int a; int new_messages = 0; @@ -718,8 +719,11 @@ void usergoto(char *where, int display_result, int *retmsgs, int *retnew) begin_critical_section(S_USERSUPP); CtdlGetRelationship(&vbuf, &CC->usersupp, &CC->quickroom); - /* Know the room ... but not if it's the page log room */ - if (strcasecmp(CC->quickroom.QRname, config.c_logpages)) { + /* Know the room ... but not if it's the page log room, or if the + * caller specified that we're only entering this room transiently. + */ + if ((strcasecmp(CC->quickroom.QRname, config.c_logpages)) + && (transiently == 0) ) { vbuf.v_flags = vbuf.v_flags & ~V_FORGET & ~V_LOCKOUT; vbuf.v_flags = vbuf.v_flags | V_ACCESS; } @@ -802,11 +806,13 @@ void cmd_goto(char *gargs) char augmented_roomname[SIZ]; char towhere[SIZ]; char password[SIZ]; + int transiently = 0; if (CtdlAccessCheck(ac_logged_in)) return; extract(towhere, gargs, 0); extract(password, gargs, 1); + transiently = extract_int(gargs, 2); getuser(&CC->usersupp, CC->curr_user); @@ -839,7 +845,7 @@ void cmd_goto(char *gargs) if (CC->internal_pgm) { memcpy(&CC->quickroom, &QRscratch, sizeof(struct quickroom)); - usergoto(NULL, 1, NULL, NULL); + usergoto(NULL, 1, transiently, NULL, NULL); return; } @@ -856,7 +862,7 @@ void cmd_goto(char *gargs) ((ra & UA_GOTOALLOWED))) { memcpy(&CC->quickroom, &QRscratch, sizeof(struct quickroom)); - usergoto(NULL, 1, NULL, NULL); + usergoto(NULL, 1, transiently, NULL, NULL); return; } else if ((QRscratch.QRflags & QR_PASSWORDED) && ((ra & UA_KNOWN) == 0) && @@ -877,7 +883,7 @@ void cmd_goto(char *gargs) } else { memcpy(&CC->quickroom, &QRscratch, sizeof(struct quickroom)); - usergoto(NULL, 1, NULL, NULL); + usergoto(NULL, 1, transiently, NULL, NULL); return; } } @@ -1469,7 +1475,7 @@ void cmd_kill(char *argbuf) if (kill_ok) { strcpy(deleted_room_name, CC->quickroom.QRname); delete_room(&CC->quickroom); /* Do the dirty work */ - usergoto(config.c_baseroom, 0, NULL, NULL); /* Return to the Lobby */ + usergoto(config.c_baseroom, 0, 0, NULL, NULL); /* Return to the Lobby */ /* tell the world what we did */ snprintf(aaa, sizeof aaa, "%s> killed by %s\n", diff --git a/citadel/room_ops.h b/citadel/room_ops.h index 5626facd6..5bf963463 100644 --- a/citadel/room_ops.h +++ b/citadel/room_ops.h @@ -22,7 +22,8 @@ void cmd_lkra (char *argbuf); void cmd_lkrn (char *argbuf); void cmd_lkro (char *argbuf); void cmd_lzrm (char *argbuf); -void usergoto (char *where, int display_result, int *msgs, int *new); +void usergoto (char *where, int display_result, int transiently, + int *msgs, int *new); void cmd_goto (char *gargs); void cmd_whok (void); void cmd_rdir (void); diff --git a/citadel/serv_imap.c b/citadel/serv_imap.c index ec3c6609f..e0ac5c03e 100644 --- a/citadel/serv_imap.c +++ b/citadel/serv_imap.c @@ -412,7 +412,7 @@ void imap_select(int num_parms, char *parms[]) { * the number of messages and number of new messages. */ memcpy(&CC->quickroom, &QRscratch, sizeof(struct quickroom)); - usergoto(NULL, 0, &msgs, &new); + usergoto(NULL, 0, 0, &msgs, &new); IMAP->selected = 1; if (!strcasecmp(parms[1], "EXAMINE")) { @@ -728,7 +728,7 @@ void imap_status(int num_parms, char *parms[]) { if (IMAP->selected) { strcpy(savedroom, CC->quickroom.QRname); } - usergoto(roomname, 0, &msgs, &new); + usergoto(roomname, 0, 0, &msgs, &new); /* * Tell the client what it wants to know. In fact, tell it *more* than @@ -749,7 +749,7 @@ void imap_status(int num_parms, char *parms[]) { * our happy day without violent explosions. */ if (IMAP->selected) { - usergoto(savedroom, 0, &msgs, &new); + usergoto(savedroom, 0, 0, &msgs, &new); } /* @@ -785,14 +785,14 @@ void imap_subscribe(int num_parms, char *parms[]) { if (IMAP->selected) { strcpy(savedroom, CC->quickroom.QRname); } - usergoto(roomname, 0, &msgs, &new); + usergoto(roomname, 0, 0, &msgs, &new); /* * If another folder is selected, go back to that room so we can resume * our happy day without violent explosions. */ if (IMAP->selected) { - usergoto(savedroom, 0, &msgs, &new); + usergoto(savedroom, 0, 0, &msgs, &new); } cprintf("%s OK SUBSCRIBE completed\r\n", parms[0]); @@ -822,7 +822,7 @@ void imap_unsubscribe(int num_parms, char *parms[]) { if (IMAP->selected) { strcpy(savedroom, CC->quickroom.QRname); } - usergoto(roomname, 0, &msgs, &new); + usergoto(roomname, 0, 0, &msgs, &new); /* * Now make the API call to zap the room @@ -840,7 +840,7 @@ void imap_unsubscribe(int num_parms, char *parms[]) { * our happy day without violent explosions. */ if (IMAP->selected) { - usergoto(savedroom, 0, &msgs, &new); + usergoto(savedroom, 0, 0, &msgs, &new); } } @@ -871,7 +871,7 @@ void imap_delete(int num_parms, char *parms[]) { if (IMAP->selected) { strcpy(savedroom, CC->quickroom.QRname); } - usergoto(roomname, 0, &msgs, &new); + usergoto(roomname, 0, 0, &msgs, &new); /* * Now delete the room. @@ -889,7 +889,7 @@ void imap_delete(int num_parms, char *parms[]) { * our happy day without violent explosions. */ if (IMAP->selected) { - usergoto(savedroom, 0, &msgs, &new); + usergoto(savedroom, 0, 0, &msgs, &new); } } diff --git a/citadel/techdoc/session.txt b/citadel/techdoc/session.txt index 24dcd739c..f9edbfc8e 100644 --- a/citadel/techdoc/session.txt +++ b/citadel/techdoc/session.txt @@ -357,6 +357,12 @@ it completes. For passworded rooms, access will be denied if the password is not supplied or is incorrect, or the command will complete successfully if the password is correct. + The third (and also) optional parameter is a "transient" flag. Normally, +when a user enters a private and/or zapped room, the room is added to the +user's known rooms list. If the transient flag is set to non-zero, this is +called a "transient goto" which causes the user to enter the room without +adding the room to the known rooms list. + The possible result codes are: OK - The command completed successfully. User is now in the room. diff --git a/citadel/user_ops.c b/citadel/user_ops.c index e631efb79..7b16a062b 100644 --- a/citadel/user_ops.c +++ b/citadel/user_ops.c @@ -410,7 +410,7 @@ void session_startup(void) create_room(SENTITEMS, 4, "", 0, 1, 0); /* Enter the lobby */ - usergoto(config.c_baseroom, 0, NULL, NULL); + usergoto(config.c_baseroom, 0, 0, NULL, NULL); /* Record this login in the Citadel log */ rec_log(CL_LOGIN, CC->curr_user); @@ -1079,7 +1079,7 @@ int CtdlForgetThisRoom(void) { lputuser(&CC->usersupp); /* Return to the Lobby, so we don't end up in an undefined room */ - usergoto(config.c_baseroom, 0, NULL, NULL); + usergoto(config.c_baseroom, 0, 0, NULL, NULL); return(0); } -- 2.39.2