Fixed a bug in the 'only replies are allowed in this room' logic in ENT0 command.
authorArt Cancro <ajc@uncensored.citadel.org>
Tue, 16 Aug 2011 19:55:15 +0000 (15:55 -0400)
committerWilfried Goesgens <dothebart@citadel.org>
Sun, 4 Sep 2011 21:46:41 +0000 (21:46 +0000)
citadel/msgbase.c

index c252f5ff0d4b57f643c2dfd5046eae96dafda2a2..c7a120f457ef018acfaf4c50aca08122ce798a4e 100644 (file)
@@ -3939,30 +3939,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);
+
 }