From 7774d018b1a2af2a5a665f80e88131e9f336876b Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 16 Aug 2011 15:55:15 -0400 Subject: [PATCH] Fixed a bug in the 'only replies are allowed in this room' logic in ENT0 command. --- citadel/msgbase.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/citadel/msgbase.c b/citadel/msgbase.c index 1313efda9..8539693b8 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -3730,30 +3730,36 @@ int CtdlDoIHavePermissionToPostInThisRoom( if ((CC->user.axlevel < AxProbU) && ((CC->room.QRflags & QR_MAILBOX) == 0)) { - snprintf(errmsgbuf, n, "Need to be validated to enter " - "(except in %s> to sysop)", MAILROOM); + snprintf(errmsgbuf, n, "Need to be validated to enter (except in %s> to sysop)", MAILROOM); return (ERROR + HIGHER_ACCESS_REQUIRED); } CtdlRoomAccess(&CC->room, &CC->user, &ra, NULL); - if ( (!(ra & UA_POSTALLOWED)) && (ra & UA_REPLYALLOWED) && (!is_reply) ) { + if (ra & UA_POSTALLOWED) { + strcpy(errmsgbuf, "OK to post or reply here"); + return(0); + } + + if ( (ra & UA_REPLYALLOWED) && (is_reply) ) { /* * To be thorough, we ought to check to see if the message they are * replying to is actually a valid one in this room, but unless this * actually becomes a problem we'll go with high performance instead. */ - snprintf(errmsgbuf, n, "You may only reply to existing messages here."); - return (ERROR + HIGHER_ACCESS_REQUIRED); + strcpy(errmsgbuf, "OK to reply here"); + return(0); } - else if (!(ra & UA_POSTALLOWED)) { - snprintf(errmsgbuf, n, "Higher access is required to post in this room."); + if ( (ra & UA_REPLYALLOWED) && (!is_reply) ) { + /* Clarify what happened with a better error message */ + snprintf(errmsgbuf, n, "You may only reply to existing messages here."); return (ERROR + HIGHER_ACCESS_REQUIRED); } - strcpy(errmsgbuf, "Ok"); - return(0); + snprintf(errmsgbuf, n, "Higher access is required to post in this room."); + return (ERROR + HIGHER_ACCESS_REQUIRED); + } -- 2.30.2