A few more API clean ups. Mainly revolving around user_ops.c
[citadel.git] / citadel / modules / imap / imap_acl.c
index c54340a497b5f18ec69daec59305c16ab86e48b2..be563b7b5ba34776bc0ab765d3d6bbdb96ae254d 100644 (file)
@@ -3,6 +3,22 @@
  *
  * Functions which implement RFC2086 (and maybe RFC4314) (IMAP ACL extension)
  *
+ *
+ * Copyright (c) 2007-2009 by the citadel.org team
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
 
@@ -38,7 +54,6 @@
 #include "citserver.h"
 #include "support.h"
 #include "config.h"
-#include "room_ops.h"
 #include "user_ops.h"
 #include "policy.h"
 #include "database.h"
@@ -51,6 +66,7 @@
 #include "genstamp.h"
 
 
+#include "ctdl_module.h"
 
 /*
  * Implements the SETACL command.
@@ -146,7 +162,7 @@ void imap_getacl(int num_parms, char *parms[]) {
        /*
         * Search for the specified room or folder
         */
-       ret = imap_grabroom(roomname, parms[2], 0);
+       ret = imap_grabroom(roomname, parms[2], 1);
        if (ret != 0) {
                cprintf("%s NO Invalid mailbox name or access denied\r\n",
                        parms[0]);
@@ -154,13 +170,13 @@ void imap_getacl(int num_parms, char *parms[]) {
        }
 
        /*
-        * usergoto() formally takes us to the desired room.  (If another
+        * CtdlUserGoto() formally takes us to the desired room.  (If another
         * folder is selected, save its name so we can return there!!!!!)
         */
        if (IMAP->selected) {
                strcpy(savedroom, CC->room.QRname);
        }
-       usergoto(roomname, 0, 0, &msgs, &new);
+       CtdlUserGoto(roomname, 0, 0, &msgs, &new);
 
        cprintf("* ACL");
        cprintf(" ");
@@ -193,7 +209,7 @@ void imap_getacl(int num_parms, char *parms[]) {
         * our happy day without violent explosions.
         */
        if (IMAP->selected) {
-               usergoto(savedroom, 0, 0, &msgs, &new);
+               CtdlUserGoto(savedroom, 0, 0, &msgs, &new);
        }
 
        cprintf("%s OK GETACL completed\r\n", parms[0]);
@@ -219,7 +235,7 @@ void imap_listrights(int num_parms, char *parms[]) {
        /*
         * Search for the specified room/folder
         */
-       ret = imap_grabroom(roomname, parms[2], 0);
+       ret = imap_grabroom(roomname, parms[2], 1);
        if (ret != 0) {
                cprintf("%s NO Invalid mailbox name or access denied\r\n",
                        parms[0]);
@@ -233,7 +249,7 @@ void imap_listrights(int num_parms, char *parms[]) {
        valid = validate_recipients(parms[3], NULL, 0);
        if (valid != NULL) {
                if (valid->num_local == 1) {
-                       ret = getuser(&temp, valid->recp_local);
+                       ret = CtdlGetUser(&temp, valid->recp_local);
                }
                free_recipients(valid);
        }
@@ -244,13 +260,13 @@ void imap_listrights(int num_parms, char *parms[]) {
        }
 
        /*
-        * usergoto() formally takes us to the desired room.  (If another
+        * CtdlUserGoto() formally takes us to the desired room.  (If another
         * folder is selected, save its name so we can return there!!!!!)
         */
        if (IMAP->selected) {
                strcpy(savedroom, CC->room.QRname);
        }
-       usergoto(roomname, 0, 0, &msgs, &new);
+       CtdlUserGoto(roomname, 0, 0, &msgs, &new);
 
 
        /*
@@ -270,7 +286,7 @@ void imap_listrights(int num_parms, char *parms[]) {
         * our happy day without violent explosions.
         */
        if (IMAP->selected) {
-               usergoto(savedroom, 0, 0, &msgs, &new);
+               CtdlUserGoto(savedroom, 0, 0, &msgs, &new);
        }
 
        cprintf("%s OK LISTRIGHTS completed\r\n", parms[0]);
@@ -294,7 +310,7 @@ void imap_myrights(int num_parms, char *parms[]) {
                return;
        }
 
-       ret = imap_grabroom(roomname, parms[2], 0);
+       ret = imap_grabroom(roomname, parms[2], 1);
        if (ret != 0) {
                cprintf("%s NO Invalid mailbox name or access denied\r\n",
                        parms[0]);
@@ -302,13 +318,13 @@ void imap_myrights(int num_parms, char *parms[]) {
        }
 
        /*
-        * usergoto() formally takes us to the desired room.  (If another
+        * CtdlUserGoto() formally takes us to the desired room.  (If another
         * folder is selected, save its name so we can return there!!!!!)
         */
        if (IMAP->selected) {
                strcpy(savedroom, CC->room.QRname);
        }
-       usergoto(roomname, 0, 0, &msgs, &new);
+       CtdlUserGoto(roomname, 0, 0, &msgs, &new);
 
        CtdlRoomAccess(&CC->room, &CC->user, &ra, NULL);
        imap_acl_flags(rights, ra);
@@ -321,7 +337,7 @@ void imap_myrights(int num_parms, char *parms[]) {
         * If a different folder was previously selected, return there now.
         */
        if ( (IMAP->selected) && (strcasecmp(roomname, savedroom)) ) {
-               usergoto(savedroom, 0, 0, &msgs, &new);
+               CtdlUserGoto(savedroom, 0, 0, &msgs, &new);
        }
 
        cprintf("%s OK MYRIGHTS completed\r\n", parms[0]);