* move policy.c into modules/expire/expire_policy.c, since it just controls this.
[citadel.git] / citadel / modules / imap / imap_acl.c
index 7ef289db5cc069f450b5a3570b8958c660311cab..39d8d70e4bb0c378fceb93685b9a23a674f55b16 100644 (file)
@@ -21,7 +21,6 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-
 #include "sysdep.h"
 #include <stdlib.h>
 #include <unistd.h>
 #include "support.h"
 #include "config.h"
 #include "user_ops.h"
-#include "policy.h"
 #include "database.h"
 #include "msgbase.h"
 #include "internet_addressing.h"
-#include "serv_imap.h"
 #include "imap_tools.h"
+#include "serv_imap.h"
 #include "imap_fetch.h"
 #include "imap_misc.h"
 #include "genstamp.h"
-
-
 #include "ctdl_module.h"
 
+
 /*
  * Implements the SETACL command.
  */
-void imap_setacl(int num_parms, char *parms[]) {
+void imap_setacl(int num_parms, ConstStr *Params) {
 
-       cprintf("%s BAD not yet implemented FIXME\r\n", parms[0]);
+       cprintf("%s BAD not yet implemented FIXME\r\n", Params[0].Key);
        return;
 }
 
@@ -81,9 +78,9 @@ void imap_setacl(int num_parms, char *parms[]) {
 /*
  * Implements the DELETEACL command.
  */
-void imap_deleteacl(int num_parms, char *parms[]) {
+void imap_deleteacl(int num_parms, ConstStr *Params) {
 
-       cprintf("%s BAD not yet implemented FIXME\r\n", parms[0]);
+       cprintf("%s BAD not yet implemented FIXME\r\n", Params[0].Key);
        return;
 }
 
@@ -102,7 +99,7 @@ void imap_acl_flags(char *rights, int ra)
         */
        if (    (ra & UA_KNOWN)                                 /* known rooms */
           ||   ((ra & UA_GOTOALLOWED) && (ra & UA_ZAPPED))     /* zapped rooms */
-          ) {
+       ) {
                strcat(rights, "l");
                strcat(rights, "r");
                strcat(rights, "s");
@@ -134,8 +131,9 @@ void imap_acl_flags(char *rights, int ra)
                         * commands are not yet implemented, omitting the flag should
                         * theoretically prevent compliant clients from attempting to
                         * perform them.
+                        *
+                        * strcat(rights, "a");
                         */
-                       /* strcat(rights, "a"); * commented out */
                }
        }
 }
@@ -144,7 +142,7 @@ void imap_acl_flags(char *rights, int ra)
 /*
  * Implements the GETACL command.
  */
-void imap_getacl(int num_parms, char *parms[]) {
+void imap_getacl(int num_parms, ConstStr *Params) {
        char roomname[ROOMNAMELEN];
        char savedroom[ROOMNAMELEN];
        int msgs, new;
@@ -155,17 +153,16 @@ void imap_getacl(int num_parms, char *parms[]) {
        char rights[32];
 
        if (num_parms != 3) {
-               cprintf("%s BAD usage error\r\n", parms[0]);
+               cprintf("%s BAD usage error\r\n", Params[0].Key);
                return;
        }
 
        /*
         * Search for the specified room or folder
         */
-       ret = imap_grabroom(roomname, parms[2], 1);
+       ret = imap_grabroom(roomname, Params[2].Key, 1);
        if (ret != 0) {
-               cprintf("%s NO Invalid mailbox name or access denied\r\n",
-                       parms[0]);
+               cprintf("%s NO Invalid mailbox name or access denied\r\n", Params[0].Key);
                return;
        }
 
@@ -180,7 +177,7 @@ void imap_getacl(int num_parms, char *parms[]) {
 
        cprintf("* ACL");
        cprintf(" ");
-       imap_strout(parms[2]);
+       imap_strout(&Params[2]);
 
        /*
         * Traverse the userlist
@@ -196,7 +193,7 @@ void imap_getacl(int num_parms, char *parms[]) {
                        imap_acl_flags(rights, ra);
                        if (!IsEmptyStr(rights)) {
                                cprintf(" ");
-                               imap_strout(temp.fullname);
+                               plain_imap_strout(temp.fullname);
                                cprintf(" %s", rights);
                        }
                }
@@ -212,14 +209,14 @@ void imap_getacl(int num_parms, char *parms[]) {
                CtdlUserGoto(savedroom, 0, 0, &msgs, &new);
        }
 
-       cprintf("%s OK GETACL completed\r\n", parms[0]);
+       cprintf("%s OK GETACL completed\r\n", Params[0].Key);
 }
 
 
 /*
  * Implements the LISTRIGHTS command.
  */
-void imap_listrights(int num_parms, char *parms[]) {
+void imap_listrights(int num_parms, ConstStr *Params) {
        char roomname[ROOMNAMELEN];
        char savedroom[ROOMNAMELEN];
        int msgs, new;
@@ -228,17 +225,16 @@ void imap_listrights(int num_parms, char *parms[]) {
        struct ctdluser temp;
 
        if (num_parms != 4) {
-               cprintf("%s BAD usage error\r\n", parms[0]);
+               cprintf("%s BAD usage error\r\n", Params[0].Key);
                return;
        }
 
        /*
         * Search for the specified room/folder
         */
-       ret = imap_grabroom(roomname, parms[2], 1);
+       ret = imap_grabroom(roomname, Params[2].Key, 1);
        if (ret != 0) {
-               cprintf("%s NO Invalid mailbox name or access denied\r\n",
-                       parms[0]);
+               cprintf("%s NO Invalid mailbox name or access denied\r\n", Params[0].Key);
                return;
        }
 
@@ -246,16 +242,15 @@ void imap_listrights(int num_parms, char *parms[]) {
         * Search for the specified user
         */
        ret = (-1);
-       valid = validate_recipients(parms[3], NULL, 0);
+       valid = validate_recipients(Params[3].Key, 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);
        }
        if (ret != 0) {
-               cprintf("%s NO Invalid user name or access denied\r\n",
-                       parms[0]);
+               cprintf("%s NO Invalid user name or access denied\r\n", Params[0].Key);
                return;
        }
 
@@ -268,19 +263,17 @@ void imap_listrights(int num_parms, char *parms[]) {
        }
        CtdlUserGoto(roomname, 0, 0, &msgs, &new);
 
-
        /*
         * Now output the list of rights
         */
        cprintf("* LISTRIGHTS ");
-       imap_strout(parms[2]);
+       imap_strout(&Params[2]);
        cprintf(" ");
-       imap_strout(parms[3]);
+       imap_strout(&Params[3]);
        cprintf(" ");
-       imap_strout("");                /* FIXME ... do something here */
+       plain_imap_strout("");          /* FIXME ... do something here */
        cprintf("\r\n");
 
-
        /*
         * If another folder is selected, go back to that room so we can resume
         * our happy day without violent explosions.
@@ -289,7 +282,7 @@ void imap_listrights(int num_parms, char *parms[]) {
                CtdlUserGoto(savedroom, 0, 0, &msgs, &new);
        }
 
-       cprintf("%s OK LISTRIGHTS completed\r\n", parms[0]);
+       cprintf("%s OK LISTRIGHTS completed\r\n", Params[0].Key);
        return;
 }
 
@@ -297,7 +290,7 @@ void imap_listrights(int num_parms, char *parms[]) {
 /*
  * Implements the MYRIGHTS command.
  */
-void imap_myrights(int num_parms, char *parms[]) {
+void imap_myrights(int num_parms, ConstStr *Params) {
        char roomname[ROOMNAMELEN];
        char savedroom[ROOMNAMELEN];
        int msgs, new;
@@ -306,14 +299,13 @@ void imap_myrights(int num_parms, char *parms[]) {
        char rights[32];
 
        if (num_parms != 3) {
-               cprintf("%s BAD usage error\r\n", parms[0]);
+               cprintf("%s BAD usage error\r\n", Params[0].Key);
                return;
        }
 
-       ret = imap_grabroom(roomname, parms[2], 1);
+       ret = imap_grabroom(roomname, Params[2].Key, 1);
        if (ret != 0) {
-               cprintf("%s NO Invalid mailbox name or access denied\r\n",
-                       parms[0]);
+               cprintf("%s NO Invalid mailbox name or access denied\r\n", Params[0].Key);
                return;
        }
 
@@ -330,7 +322,7 @@ void imap_myrights(int num_parms, char *parms[]) {
        imap_acl_flags(rights, ra);
 
        cprintf("* MYRIGHTS ");
-       imap_strout(parms[2]);
+       imap_strout(&Params[2]);
        cprintf(" %s\r\n", rights);
 
        /*
@@ -340,8 +332,6 @@ void imap_myrights(int num_parms, char *parms[]) {
                CtdlUserGoto(savedroom, 0, 0, &msgs, &new);
        }
 
-       cprintf("%s OK MYRIGHTS completed\r\n", parms[0]);
+       cprintf("%s OK MYRIGHTS completed\r\n", Params[0].Key);
        return;
 }
-
-