/*
- * $Id$
- *
* Server functions which perform operations on room objects.
*
*/
int *result, int *view)
{
int retval = 0;
- struct visit vbuf;
+ visit vbuf;
+ int is_me = 0;
+ int is_guest = 0;
+
+ if (userbuf == &CC->user) {
+ is_me = 1;
+ }
+
+ if ((is_me) && (config.c_guest_logins) && (!CC->logged_in)) {
+ is_guest = 1;
+ }
/* for internal programs, always do everything */
if (((CC->internal_pgm)) && (roombuf->QRflags & QR_INUSE)) {
goto SKIP_EVERYTHING;
}
+ /* If guest mode is enabled, always grant access to the Lobby */
+ if ((is_guest) && (!strcasecmp(roombuf->QRname, BASEROOM))) {
+ retval = (UA_KNOWN | UA_GOTOALLOWED);
+ vbuf.v_view = 0;
+ goto SKIP_EVERYTHING;
+ }
+
/* Locate any applicable user/room relationships */
- CtdlGetRelationship(&vbuf, userbuf, roombuf);
+ if (is_guest) {
+ memset(&vbuf, 0, sizeof vbuf);
+ }
+ else {
+ CtdlGetRelationship(&vbuf, userbuf, roombuf);
+ }
/* Force the properties of the Aide room */
if (!strcasecmp(roombuf->QRname, config.c_aideroom)) {
* - It is a read-only room
*/
int post_allowed = 1;
- if (CC->user.axlevel < AxProbU) post_allowed = 0;
- if ((CC->user.axlevel < AxNetU) && (CC->room.QRflags & QR_NETWORK)) post_allowed = 0;
+ if (userbuf->axlevel < AxProbU) post_allowed = 0;
+ if ((userbuf->axlevel < AxNetU) && (roombuf->QRflags & QR_NETWORK)) post_allowed = 0;
if (roombuf->QRflags & QR_READONLY) post_allowed = 0;
if (post_allowed) {
retval = retval | UA_POSTALLOWED;
/* If "collaborative deletion" is active for this room, any user who can post
* is also allowed to delete
*/
- if (CC->room.QRflags2 & QR2_COLLABDEL) {
+ if (roombuf->QRflags2 & QR2_COLLABDEL) {
if (retval & UA_POSTALLOWED) {
retval = retval | UA_DELETEALLOWED;
}
if (!IsEmptyStr(argbuf))
FloorBeingSearched = extract_int(argbuf, 0);
- if (CtdlAccessCheck(ac_logged_in)) return;
+ if (CtdlAccessCheck(ac_logged_in_or_guest)) return;
- if (CtdlGetUser(&CC->user, CC->curr_user)) {
- cprintf("%d Can't locate user!\n", ERROR + INTERNAL_ERROR);
- return;
- }
+ CtdlGetUser(&CC->user, CC->curr_user);
cprintf("%d Accessible rooms:\n", LISTING_FOLLOWS);
CtdlForEachRoom(cmd_lrms_backend, &FloorBeingSearched);
if (!IsEmptyStr(argbuf))
FloorBeingSearched = extract_int(argbuf, 0);
- if (CtdlAccessCheck(ac_logged_in)) return;
+ if (CtdlAccessCheck(ac_logged_in_or_guest)) return;
- if (CtdlGetUser(&CC->user, CC->curr_user)) {
- cprintf("%d Can't locate user!\n", ERROR + INTERNAL_ERROR);
- return;
- }
+ CtdlGetUser(&CC->user, CC->curr_user);
cprintf("%d Known rooms:\n", LISTING_FOLLOWS);
CtdlForEachRoom(cmd_lkra_backend, &FloorBeingSearched);
if (!IsEmptyStr(argbuf))
FloorBeingSearched = extract_int(argbuf, 0);
- if (CtdlAccessCheck(ac_logged_in)) return;
+ if (CtdlAccessCheck(ac_logged_in_or_guest)) return;
- if (CtdlGetUser(&CC->user, CC->curr_user)) {
- cprintf("%d Can't locate user!\n", ERROR + INTERNAL_ERROR);
- return;
- }
+ CtdlGetUser(&CC->user, CC->curr_user);
cprintf("%d Rooms w/ new msgs:\n", LISTING_FOLLOWS);
CtdlForEachRoom(cmd_lkrn_backend, &FloorBeingSearched);
if (!IsEmptyStr(argbuf))
FloorBeingSearched = extract_int(argbuf, 0);
- if (CtdlAccessCheck(ac_logged_in)) return;
+ if (CtdlAccessCheck(ac_logged_in_or_guest)) return;
- if (CtdlGetUser(&CC->user, CC->curr_user)) {
- cprintf("%d Can't locate user!\n", ERROR + INTERNAL_ERROR);
- return;
- }
+ CtdlGetUser(&CC->user, CC->curr_user);
cprintf("%d Rooms w/o new msgs:\n", LISTING_FOLLOWS);
CtdlForEachRoom(cmd_lkro_backend, &FloorBeingSearched);
if (!IsEmptyStr(argbuf))
FloorBeingSearched = extract_int(argbuf, 0);
- if (CtdlAccessCheck(ac_logged_in)) return;
+ if (CtdlAccessCheck(ac_logged_in_or_guest)) return;
- if (CtdlGetUser(&CC->user, CC->curr_user)) {
- cprintf("%d Can't locate user!\n", ERROR + INTERNAL_ERROR);
- return;
- }
+ CtdlGetUser(&CC->user, CC->curr_user);
cprintf("%d Zapped rooms:\n", LISTING_FOLLOWS);
CtdlForEachRoom(cmd_lzrm_backend, &FloorBeingSearched);
int rmailflag;
int raideflag;
int newmailcount = 0;
- struct visit vbuf;
+ visit vbuf;
char truncated_roomname[ROOMNAMELEN];
struct cdbdata *cdbfr;
long *msglist = NULL;
char password[32];
int transiently = 0;
- if (CtdlAccessCheck(ac_logged_in)) return;
+ if (CtdlAccessCheck(ac_logged_in_or_guest)) return;
extract_token(towhere, gargs, 0, '|', sizeof towhere);
extract_token(password, gargs, 1, '|', sizeof password);
struct ctdlroom qrbuf;
struct floor flbuf;
- struct visit vbuf;
+ visit vbuf;
CtdlLogPrintf(CTDL_DEBUG, "CtdlCreateRoom(name=%s, type=%d, view=%d)\n",
new_room_name, new_room_type, new_room_view);
CtdlRegisterProtoHook(cmd_eflr, "EFLR", "Autoconverted. TODO: document me.");
}
/* return our Subversion id for the Log */
- return "$Id$";
+ return "room_ops";
}