US_NOPROMPT | US_DISAPPEAR | US_PAGINATOR | \
US_FLOORS | US_COLOR | US_PROMPTCTL | US_EXTEDIT)
-#define UA_KNOWN 2
-#define UA_GOTOALLOWED 4
-#define UA_HASNEWMSGS 8
-#define UA_ZAPPED 16
-#define UA_POSTALLOWED 32
-#define UA_ADMINALLOWED 64
-#define UA_DELETEALLOWED 128
+#define UA_KNOWN 2 /* Room appears in a 'known rooms' list */
+#define UA_GOTOALLOWED 4 /* User may goto this room if specified by exact name */
+#define UA_HASNEWMSGS 8 /* Unread messages exist in this room */
+#define UA_ZAPPED 16 /* User has forgotten (zapped) this room */
+#define UA_POSTALLOWED 32 /* User may post top-level messages here */
+#define UA_ADMINALLOWED 64 /* Aide or Room Aide rights exist here */
+#define UA_DELETEALLOWED 128 /* User is allowed to delete messages from this room */
+#define UA_REPLYALLOWED 256 /* User is allowed to reply to existing messages here */
#ifdef __cplusplus
}
* room. Returns a *CITADEL ERROR CODE* and puts a message in errmsgbuf, or
* returns 0 on success.
*/
-int CtdlDoIHavePermissionToPostInThisRoom(char *errmsgbuf,
- size_t n,
- const char* RemoteIdentifier,
- int PostPublic) {
+int CtdlDoIHavePermissionToPostInThisRoom(
+ char *errmsgbuf,
+ size_t n,
+ const char* RemoteIdentifier,
+ int PostPublic,
+ int is_reply
+) {
int ra;
if (!(CC->logged_in) &&
}
CtdlRoomAccess(&CC->room, &CC->user, &ra, NULL);
- if (!(ra & UA_POSTALLOWED)) {
+
+ if ( (!(ra & UA_POSTALLOWED)) && (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);
+ }
+
+ else if (!(ra & UA_POSTALLOWED)) {
snprintf(errmsgbuf, n, "Higher access is required to post in this room.");
return (ERROR + HIGHER_ACCESS_REQUIRED);
}
CC->room = tempQR;
/* Check permissions to send mail to this room */
- err = CtdlDoIHavePermissionToPostInThisRoom(errmsg,
- sizeof errmsg,
- RemoteIdentifier,
- Flags
+ err = CtdlDoIHavePermissionToPostInThisRoom(
+ errmsg,
+ sizeof errmsg,
+ RemoteIdentifier,
+ Flags,
+ 0 /* 0 = not a reply */
);
if (err)
{
/* first check to make sure the request is valid. */
- err = CtdlDoIHavePermissionToPostInThisRoom(errmsg, sizeof errmsg, NULL, POST_LOGGED_IN);
+ err = CtdlDoIHavePermissionToPostInThisRoom(
+ errmsg,
+ sizeof errmsg,
+ NULL,
+ POST_LOGGED_IN,
+ (!IsEmptyStr(references)) /* is this a reply? or a top-level post? */
+ );
if (err)
{
cprintf("%d %s\n", err, errmsg);
CHECK_EXISTANCE,
POST_LMTP
};
+
int CtdlDoIHavePermissionToPostInThisRoom(char *errmsgbuf,
- size_t n,
- const char* RemoteIdentifier,
- int PostPublic);
+ size_t n,
+ const char* RemoteIdentifier,
+ int PostPublic,
+ int is_reply
+);
/* values for which_set */
/* for internal programs, always do everything */
if (((CC->internal_pgm)) && (roombuf->QRflags & QR_INUSE)) {
- retval = (UA_KNOWN | UA_GOTOALLOWED | UA_POSTALLOWED | UA_DELETEALLOWED);
+ retval = (UA_KNOWN | UA_GOTOALLOWED | UA_POSTALLOWED | UA_DELETEALLOWED | UA_REPLYALLOWED);
vbuf.v_view = 0;
goto SKIP_EVERYTHING;
}
/* Force the properties of the Aide room */
if (!strcasecmp(roombuf->QRname, config.c_aideroom)) {
if (userbuf->axlevel >= AxAideU) {
- retval = UA_KNOWN | UA_GOTOALLOWED | UA_POSTALLOWED | UA_DELETEALLOWED;
+ retval = UA_KNOWN | UA_GOTOALLOWED | UA_POSTALLOWED | UA_DELETEALLOWED | UA_REPLYALLOWED;
} else {
retval = 0;
}
/* Also, mailbox owners can delete their messages */
if (roombuf->QRflags & QR_MAILBOX) {
if (userbuf->usernum == atol(roombuf->QRname)) {
- retval = retval | UA_KNOWN | UA_GOTOALLOWED | UA_POSTALLOWED | UA_DELETEALLOWED;
+ retval = retval | UA_KNOWN | UA_GOTOALLOWED | UA_POSTALLOWED | UA_DELETEALLOWED | UA_REPLYALLOWED;
}
/* An explicit match means the user belongs in this room */
if (vbuf.v_flags & V_ACCESS) {
- retval = retval | UA_KNOWN | UA_GOTOALLOWED | UA_POSTALLOWED | UA_DELETEALLOWED;
+ retval = retval | UA_KNOWN | UA_GOTOALLOWED | UA_POSTALLOWED | UA_DELETEALLOWED | UA_REPLYALLOWED;
}
}
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;
+ retval = retval | UA_POSTALLOWED | UA_REPLYALLOWED;
}
/* If "collaborative deletion" is active for this room, any user who can post
}
/* If user is explicitly locked out of this room, deny everything */
if (vbuf.v_flags & V_LOCKOUT) {
- retval = retval & ~UA_KNOWN & ~UA_GOTOALLOWED & ~UA_POSTALLOWED;
+ retval = retval & ~UA_KNOWN & ~UA_GOTOALLOWED & ~UA_POSTALLOWED & ~UA_REPLYALLOWED;
}
/* Aides get access to all private rooms */
if ( (userbuf->axlevel >= AxAideU)
&& ((roombuf->QRflags & QR_MAILBOX) == 0) ) {
if (vbuf.v_flags & V_FORGET) {
- retval = retval | UA_GOTOALLOWED | UA_POSTALLOWED;
+ retval = retval | UA_GOTOALLOWED | UA_POSTALLOWED | UA_REPLYALLOWED;
}
else {
- retval = retval | UA_KNOWN | UA_GOTOALLOWED | UA_POSTALLOWED;
+ retval = retval | UA_KNOWN | UA_GOTOALLOWED | UA_POSTALLOWED | UA_REPLYALLOWED;
}
}
*/
if ( (userbuf->axlevel >= AxAideU)
&& (roombuf->QRflags & QR_MAILBOX) ) {
- retval = retval | UA_GOTOALLOWED | UA_POSTALLOWED;
+ retval = retval | UA_GOTOALLOWED | UA_POSTALLOWED | UA_REPLYALLOWED;
}
/* Aides and Room Aides have admin privileges */
if ( (userbuf->axlevel >= AxAideU)
|| (userbuf->usernum == roombuf->QRroomaide)
) {
- retval = retval | UA_ADMINALLOWED | UA_DELETEALLOWED | UA_POSTALLOWED;
+ retval = retval | UA_ADMINALLOWED | UA_DELETEALLOWED | UA_POSTALLOWED | UA_REPLYALLOWED;
}
NEWMSG: /* By the way, we also check for the presence of new messages */