+/*
+ * Given the bits returned by CtdlRoomAccess(), populate a string buffer
+ * with IMAP ACL format flags. This code is common to GETACL and MYRIGHTS.
+ */
+void imap_acl_flags(char *rights, int ra)
+{
+ strcpy(rights, "");
+
+ /* l - lookup (mailbox is visible to LIST/LSUB commands, SUBSCRIBE mailbox)
+ * r - read (SELECT the mailbox, perform STATUS)
+ * s - keep seen/unseen information across sessions (set or clear \SEEN flag
+ * via STORE, also set \SEEN during APPEND/COPY/ FETCH BODY[...])
+ * e - perform EXPUNGE and expunge as a part of CLOSE
+ */
+ if ( (ra & UA_KNOWN) /* known rooms */
+ || ((ra & UA_GOTOALLOWED) && (ra & UA_ZAPPED)) /* zapped rooms */
+ ) {
+ strcat(rights, "l");
+ strcat(rights, "r");
+ strcat(rights, "s");
+ strcat(rights, "e");
+
+ /* Only output the remaining flags if the room is known */
+
+ /* w - write (set or clear arbitrary flags; not supported in Citadel) */
+
+ /* i - insert (perform APPEND, COPY into mailbox) */
+ /* p - post (send mail to submission address for mailbox - not enforced) */
+ if (ra & UA_POSTALLOWED) {
+ strcat(rights, "i");
+ strcat(rights, "p");
+ }
+
+ /* k - create mailboxes in this hierarchy */
+
+ /* t - delete messages (set/clear \Deleted flag) */
+
+ /* a - administer (perform SETACL/DELETEACL/GETACL/LISTRIGHTS) */
+ /* x - delete mailbox (DELETE mailbox, old mailbox name in RENAME) */
+ if (ra & UA_ADMINALLOWED) {
+ strcat(rights, "a");
+ strcat(rights, "x");
+ }
+ }
+}
+