4 * Functions which implement RFC2086/RFC4314 (IMAP ACL extension)
17 #include <sys/types.h>
19 #if TIME_WITH_SYS_TIME
20 # include <sys/time.h>
24 # include <sys/time.h>
36 #include "sysdep_decls.h"
37 #include "citserver.h"
40 #include "serv_extensions.h"
47 #include "internet_addressing.h"
48 #include "serv_imap.h"
49 #include "imap_tools.h"
50 #include "imap_fetch.h"
51 #include "imap_misc.h"
57 * Implements the SETACL command.
59 void imap_setacl(int num_parms, char *parms[]) {
61 cprintf("%s BAD not yet implemented FIXME\r\n", parms[0]);
67 * Implements the DELETEACL command.
69 void imap_deleteacl(int num_parms, char *parms[]) {
71 cprintf("%s BAD not yet implemented FIXME\r\n", parms[0]);
78 * Implements the GETACL command.
80 void imap_getacl(int num_parms, char *parms[]) {
81 char roomname[ROOMNAMELEN];
82 char savedroom[ROOMNAMELEN];
86 struct cdbdata *cdbus;
91 cprintf("%s BAD usage error\r\n", parms[0]);
95 ret = imap_grabroom(roomname, parms[2], 0);
97 cprintf("%s NO Invalid mailbox name or access denied\r\n",
103 * usergoto() formally takes us to the desired room. (If another
104 * folder is selected, save its name so we can return there!!!!!)
106 if (IMAP->selected) {
107 strcpy(savedroom, CC->room.QRname);
109 usergoto(roomname, 0, 0, &msgs, &new);
113 imap_strout(parms[2]);
116 * Traverse the userlist
118 cdb_rewind(CDB_USERS);
119 while (cdbus = cdb_next_item(CDB_USERS), cdbus != NULL) {
120 memset(&temp, 0, sizeof temp);
121 memcpy(&temp, cdbus->ptr, sizeof temp);
124 CtdlRoomAccess(&CC->room, &temp, &ra, NULL);
125 if (strlen(temp.fullname) > 0) {
128 /* Known, zapped, etc. mailboxes can probably be LIST-ed */
129 /* FIXME don't give away hidden rooms */
130 if (ra & UA_GOTOALLOWED) strcat(rights, "l");
132 /* Known rooms can be LSUB-ed */
133 if (ra & UA_KNOWN) strcat(rights, "r");
135 /* FIXME do the rest */
137 if (strlen(rights) > 0) {
139 imap_strout(temp.fullname);
140 cprintf(" %s", rights);
148 * If another folder is selected, go back to that room so we can resume
149 * our happy day without violent explosions.
151 if (IMAP->selected) {
152 usergoto(savedroom, 0, 0, &msgs, &new);
155 cprintf("%s OK GETACL completed\r\n", parms[0]);
160 * Implements the LISTRIGHTS command.
162 void imap_listrights(int num_parms, char *parms[]) {
164 cprintf("%s BAD not yet implemented FIXME\r\n", parms[0]);
170 * Implements the MYRIGHTS command.
172 void imap_myrights(int num_parms, char *parms[]) {
174 cprintf("%s BAD not yet implemented FIXME\r\n", parms[0]);