projects
/
citadel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8be8a5b
)
Improved coding style of the complex conditionals in CtdlRoomAccess()
author
Art Cancro
<ajc@uncensored.citadel.org>
Tue, 16 Aug 2011 03:49:35 +0000
(23:49 -0400)
committer
Wilfried Goesgens
<dothebart@citadel.org>
Sun, 4 Sep 2011 21:46:14 +0000
(21:46 +0000)
citadel/room_ops.c
patch
|
blob
|
history
diff --git
a/citadel/room_ops.c
b/citadel/room_ops.c
index 30b14ae3caa84eb6b73cecbe672fb9dd6036cb59..1c68a340c585f7048355f189c54773c6498a7970 100644
(file)
--- a/
citadel/room_ops.c
+++ b/
citadel/room_ops.c
@@
-111,8
+111,9
@@
void CtdlRoomAccess(struct ctdlroom *roombuf, struct ctdluser *userbuf,
}
/* If this is a public room, it's accessible... */
}
/* If this is a public room, it's accessible... */
- if ( ((roombuf->QRflags & QR_PRIVATE) == 0)
- && ((roombuf->QRflags & QR_MAILBOX) == 0) ) {
+ if ( ((roombuf->QRflags & QR_PRIVATE) == 0)
+ && ((roombuf->QRflags & QR_MAILBOX) == 0)
+ ) {
retval = retval | UA_KNOWN | UA_GOTOALLOWED;
}
retval = retval | UA_KNOWN | UA_GOTOALLOWED;
}
@@
-124,8
+125,9
@@
void CtdlRoomAccess(struct ctdlroom *roombuf, struct ctdluser *userbuf,
}
/* For private rooms, check the generation number matchups */
}
/* For private rooms, check the generation number matchups */
- if ( (roombuf->QRflags & QR_PRIVATE)
- && ((roombuf->QRflags & QR_MAILBOX) == 0) ) {
+ if ( (roombuf->QRflags & QR_PRIVATE)
+ && ((roombuf->QRflags & QR_MAILBOX) == 0)
+ ) {
/* An explicit match means the user belongs in this room */
if (vbuf.v_flags & V_ACCESS) {
/* An explicit match means the user belongs in this room */
if (vbuf.v_flags & V_ACCESS) {
@@
-134,8
+136,9
@@
void CtdlRoomAccess(struct ctdlroom *roombuf, struct ctdluser *userbuf,
/* Otherwise, check if this is a guess-name or passworded
* room. If it is, a goto may at least be attempted
*/
/* Otherwise, check if this is a guess-name or passworded
* room. If it is, a goto may at least be attempted
*/
- else if ((roombuf->QRflags & QR_PRIVATE)
- || (roombuf->QRflags & QR_PASSWORDED)) {
+ else if ( (roombuf->QRflags & QR_PRIVATE)
+ || (roombuf->QRflags & QR_PASSWORDED)
+ ) {
retval = retval & ~UA_KNOWN;
retval = retval | UA_GOTOALLOWED;
}
retval = retval & ~UA_KNOWN;
retval = retval | UA_GOTOALLOWED;
}
@@
-196,21
+199,24
@@
void CtdlRoomAccess(struct ctdlroom *roombuf, struct ctdluser *userbuf,
/* Check to see if the user has forgotten this room */
if (vbuf.v_flags & V_FORGET) {
retval = retval & ~UA_KNOWN;
/* Check to see if the user has forgotten this room */
if (vbuf.v_flags & V_FORGET) {
retval = retval & ~UA_KNOWN;
- if ( ( ((roombuf->QRflags & QR_PRIVATE) == 0)
- && ((roombuf->QRflags & QR_MAILBOX) == 0) )
- || ( (roombuf->QRflags & QR_MAILBOX)
- && (atol(roombuf->QRname) == CC->user.usernum))) {
+ if ( ( ((roombuf->QRflags & QR_PRIVATE) == 0)
+ && ((roombuf->QRflags & QR_MAILBOX) == 0)
+ ) || ( (roombuf->QRflags & QR_MAILBOX)
+ && (atol(roombuf->QRname) == CC->user.usernum))
+ ) {
retval = retval | UA_ZAPPED;
}
}
retval = retval | UA_ZAPPED;
}
}
+
/* 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 & ~UA_REPLYALLOWED;
}
/* Aides get access to all private rooms */
/* 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 & ~UA_REPLYALLOWED;
}
/* Aides get access to all private rooms */
- if ( (userbuf->axlevel >= AxAideU)
- && ((roombuf->QRflags & QR_MAILBOX) == 0) ) {
+ if ( (userbuf->axlevel >= AxAideU)
+ && ((roombuf->QRflags & QR_MAILBOX) == 0)
+ ) {
if (vbuf.v_flags & V_FORGET) {
retval = retval | UA_GOTOALLOWED | UA_POSTALLOWED | UA_REPLYALLOWED;
}
if (vbuf.v_flags & V_FORGET) {
retval = retval | UA_GOTOALLOWED | UA_POSTALLOWED | UA_REPLYALLOWED;
}
@@
-222,15
+228,16
@@
void CtdlRoomAccess(struct ctdlroom *roombuf, struct ctdluser *userbuf,
/* Aides can gain access to mailboxes as well, but they don't show
* by default.
*/
/* Aides can gain access to mailboxes as well, but they don't show
* by default.
*/
- if ( (userbuf->axlevel >= AxAideU)
- && (roombuf->QRflags & QR_MAILBOX) ) {
+ if ( (userbuf->axlevel >= AxAideU)
+ && (roombuf->QRflags & QR_MAILBOX)
+ ) {
retval = retval | UA_GOTOALLOWED | UA_POSTALLOWED | UA_REPLYALLOWED;
}
/* Aides and Room Aides have admin privileges */
retval = retval | UA_GOTOALLOWED | UA_POSTALLOWED | UA_REPLYALLOWED;
}
/* Aides and Room Aides have admin privileges */
- if ( (userbuf->axlevel >= AxAideU)
- || (userbuf->usernum == roombuf->QRroomaide)
-
) {
+ if (
(userbuf->axlevel >= AxAideU)
+
|| (userbuf->usernum == roombuf->QRroomaide)
+ ) {
retval = retval | UA_ADMINALLOWED | UA_DELETEALLOWED | UA_POSTALLOWED | UA_REPLYALLOWED;
}
retval = retval | UA_ADMINALLOWED | UA_DELETEALLOWED | UA_POSTALLOWED | UA_REPLYALLOWED;
}