int retval = 0;
struct visit vbuf;
+ lprintf(9, "CtdlRoomAccess( %s , %s )\n",
+ roombuf->QRname, userbuf->fullname);
/* for internal programs, always do everything */
if (((CC->internal_pgm)) && (roombuf->QRflags & QR_INUSE)) {
/* If this is a public room, it's accessible... */
if ( ((roombuf->QRflags & QR_PRIVATE) == 0)
&& ((roombuf->QRflags & QR_MAILBOX) == 0) ) {
+ lprintf(9, " -- public room, known/allowed\n");
retval = retval | UA_KNOWN | UA_GOTOALLOWED;
}
/* If this is a preferred users only room, check access level */
if (roombuf->QRflags & QR_PREFONLY) {
if (userbuf->axlevel < 5) {
+ lprintf(9, " -- not a preferred user!\n");
retval = retval & ~UA_KNOWN & ~UA_GOTOALLOWED;
}
}
/* For private rooms, check the generation number matchups */
if ( (roombuf->QRflags & QR_PRIVATE)
&& ((roombuf->QRflags & QR_MAILBOX) == 0) ) {
+ lprintf(9, " -- checking private room access\n");
/* An explicit match means the user belongs in this room */
if (vbuf.v_flags & V_ACCESS) {
+ lprintf(9, " -- explicit match! known/allowed\n");
retval = retval | UA_KNOWN | UA_GOTOALLOWED;
}
/* Otherwise, check if this is a guess-name or passworded
*/
else if ((roombuf->QRflags & QR_PRIVATE)
|| (roombuf->QRflags & QR_PASSWORDED)) {
+ lprintf(9, " -- guessable.\n");
retval = retval & ~UA_KNOWN;
retval = retval | UA_GOTOALLOWED;
}
/* For mailbox rooms, also check the generation number matchups */
if (roombuf->QRflags & QR_MAILBOX) {
+ lprintf(9, " -- checking mailbox room access\n");
if (userbuf->usernum == atol(roombuf->QRname)) {
+ lprintf(9, " -- owner! known/allowed\n");
retval = retval | UA_KNOWN | UA_GOTOALLOWED;
}
/* An explicit match means the user belongs in this room */
if (vbuf.v_flags & V_ACCESS) {
+ lprintf(9, " -- explicit match! known/allowed\n");
retval = retval | UA_KNOWN | UA_GOTOALLOWED;
}
}
/* Check to see if the user has forgotten this room */
if (vbuf.v_flags & V_FORGET) {
+ lprintf(9, " -- forgotten room!\n");
retval = retval & ~UA_KNOWN;
retval = retval | UA_ZAPPED;
}
/* If user is explicitly locked out of this room, deny everything */
if (vbuf.v_flags & V_LOCKOUT) {
+ lprintf(9, " -- explicit lockout!\n");
retval = retval & ~UA_KNOWN & ~UA_GOTOALLOWED;
}
/* Aides get access to everything */
if (userbuf->axlevel >= 6) {
+ lprintf(9, " -- user is an Aide\n");
if (vbuf.v_flags & V_FORGET) {
+ lprintf(9, " -- forgotten room\n");
retval = retval | UA_GOTOALLOWED;
}
else {
+ lprintf(9, " -- goto allowed\n");
retval = retval | UA_GOTOALLOWED;
if ((roombuf->QRflags & QR_MAILBOX) == 0) {
+ lprintf(9, " -- not mailbox, make it known\n");
retval = retval | UA_KNOWN;
}
}
NEWMSG: /* By the way, we also check for the presence of new messages */
if (is_msg_in_mset(vbuf.v_seen, roombuf->QRhighest) == 0) {
+ lprintf(9, " -- has new messages\n");
retval = retval | UA_HASNEWMSGS;
}
/* System rooms never show up in the list. */
if (roombuf->QRflags2 & QR2_SYSTEM) {
+ lprintf(9, " -- system room -- hide it\n");
retval = retval & ~UA_KNOWN;
}
return (retval);