]> code.citadel.org Git - citadel.git/blobdiff - citadel/room_ops.c
* oops, an oversight ... CtdlRoomAccess() needs to convey UA_DELETEALLOWED for intern...
[citadel.git] / citadel / room_ops.c
index e1d501a1c4cf7860a4544126136d64de52111303..07ad2f5e061ab7e051f1f5388b82b933a06a3925 100644 (file)
@@ -42,6 +42,8 @@
 #include "citadel_dirs.h"
 #include "threads.h"
 
+#include "ctdl_module.h"
+
 struct floor *floorcache[MAXFLOORS];
 
 /*
@@ -55,7 +57,7 @@ void CtdlRoomAccess(struct ctdlroom *roombuf, struct ctdluser *userbuf,
 
        /* for internal programs, always do everything */
        if (((CC->internal_pgm)) && (roombuf->QRflags & QR_INUSE)) {
-               retval = (UA_KNOWN | UA_GOTOALLOWED | UA_POSTALLOWED);
+               retval = (UA_KNOWN | UA_GOTOALLOWED | UA_POSTALLOWED | UA_DELETEALLOWED);
                vbuf.v_view = 0;
                goto SKIP_EVERYTHING;
        }
@@ -496,9 +498,9 @@ void delete_msglist(struct ctdlroom *whichroom)
 /*
  * Message pointer compare function for sort_msglist()
  */
-int sort_msglist_cmp(long *m1, long *m2) {
-       if (*m1 > *m2) return(1);
-       if (*m1 < *m2) return(-1);
+int sort_msglist_cmp(const void *m1, const void *m2) {
+       if ((*(const long *)m1) > (*(const long *)m2)) return(1);
+       if ((*(const long *)m1) < (*(const long *)m2)) return(-1);
        return(0);
 }
 
@@ -975,6 +977,9 @@ void convert_room_name_macros(char *towhere, size_t maxlen) {
        else if (!strcasecmp(towhere, "_TRASH_")) {
                safestrncpy(towhere, USERTRASHROOM, maxlen);
        }
+       else if (!strcasecmp(towhere, "_DRAFTS_")) {
+               safestrncpy(towhere, USERDRAFTROOM, maxlen);
+       }
        else if (!strcasecmp(towhere, "_BITBUCKET_")) {
                safestrncpy(towhere, config.c_twitroom, maxlen);
        }
@@ -1086,7 +1091,7 @@ void cmd_goto(char *gargs)
 }
 
 
-void cmd_whok(void)
+void cmd_whok(char *cmdbuf)
 {
        struct ctdluser temp;
        struct cdbdata *cdbus;
@@ -1112,7 +1117,7 @@ void cmd_whok(void)
 /*
  * RDIR command for room directory
  */
-void cmd_rdir(void)
+void cmd_rdir(char *cmdbuf)
 {
        char buf[256];
        char comment[256];
@@ -1167,8 +1172,11 @@ void cmd_rdir(void)
                        stat(buf, &statbuf);    /* stat the file */
                        if (!(statbuf.st_mode & S_IFREG))
                        {
-                               snprintf(buf2, sizeof buf2, "Command RDIR found something that is not a useable file. It should be cleaned up.\n RDIR found this non regular file:\n%s\n", buf);
-                               aide_message(buf2, "RDIR found bad file");
+                               snprintf(buf2, sizeof buf2,
+                                       "\"%s\" appears in the file directory for room \"%s\" but is not a regular file.  Directories, named pipes, sockets, etc. are not usable in Citadel room directories.\n",
+                                       buf, CC->room.QRname
+                               );
+                               aide_message(buf2, "Unusable data found in room directory");
                                continue;       /* not a useable file type so don't show it */
                        }
                        safestrncpy(comment, "", sizeof comment);
@@ -1202,7 +1210,7 @@ void cmd_rdir(void)
 /*
  * get room parameters (aide or room aide command)
  */
-void cmd_getr(void)
+void cmd_getr(char *cmdbuf)
 {
        if (CtdlAccessCheck(ac_room_aide)) return;
 
@@ -1498,7 +1506,7 @@ void cmd_setr(char *args)
 /* 
  * get the name of the room aide for this room
  */
-void cmd_geta(void)
+void cmd_geta(char *cmdbuf)
 {
        struct ctdluser usbuf;
 
@@ -1559,7 +1567,7 @@ void cmd_seta(char *new_ra)
 /* 
  * retrieve info file for this room
  */
-void cmd_rinf(void)
+void cmd_rinf(char *gargs)
 {
        char filename[128];
        char buf[SIZ];
@@ -2000,7 +2008,7 @@ void cmd_einf(char *ok)
 /* 
  * cmd_lflr()   -  List all known floors
  */
-void cmd_lflr(void)
+void cmd_lflr(char *gargs)
 {
        int a;
        struct floor flbuf;
@@ -2157,3 +2165,35 @@ void cmd_eflr(char *argbuf)
 
        cprintf("%d Ok\n", CIT_OK);
 }
+
+
+/*****************************************************************************/
+/*                      MODULE INITIALIZATION STUFF                          */
+/*****************************************************************************/
+
+CTDL_MODULE_INIT(room_ops)
+{
+       CtdlRegisterProtoHook(cmd_lrms, "LRMS", "Autoconverted. TODO: document me.");
+       CtdlRegisterProtoHook(cmd_lkra, "LKRA", "Autoconverted. TODO: document me.");
+       CtdlRegisterProtoHook(cmd_lkrn, "LKRN", "Autoconverted. TODO: document me.");
+       CtdlRegisterProtoHook(cmd_lkro, "LKRO", "Autoconverted. TODO: document me.");
+       CtdlRegisterProtoHook(cmd_lzrm, "LZRM", "Autoconverted. TODO: document me.");
+       CtdlRegisterProtoHook(cmd_lprm, "LPRM", "Autoconverted. TODO: document me.");
+       CtdlRegisterProtoHook(cmd_goto, "GOTO", "Autoconverted. TODO: document me.");
+       CtdlRegisterProtoHook(cmd_whok, "WHOK", "Autoconverted. TODO: document me.");
+       CtdlRegisterProtoHook(cmd_rdir, "RDIR", "Autoconverted. TODO: document me.");
+       CtdlRegisterProtoHook(cmd_getr, "GETR", "Autoconverted. TODO: document me.");
+       CtdlRegisterProtoHook(cmd_setr, "SETR", "Autoconverted. TODO: document me.");
+       CtdlRegisterProtoHook(cmd_geta, "GETA", "Autoconverted. TODO: document me.");
+       CtdlRegisterProtoHook(cmd_seta, "SETA", "Autoconverted. TODO: document me.");
+       CtdlRegisterProtoHook(cmd_rinf, "RINF", "Autoconverted. TODO: document me.");
+       CtdlRegisterProtoHook(cmd_kill, "KILL", "Autoconverted. TODO: document me.");
+       CtdlRegisterProtoHook(cmd_cre8, "CRE8", "Autoconverted. TODO: document me.");
+       CtdlRegisterProtoHook(cmd_einf, "EINF", "Autoconverted. TODO: document me.");
+       CtdlRegisterProtoHook(cmd_lflr, "LFLR", "Autoconverted. TODO: document me.");
+       CtdlRegisterProtoHook(cmd_cflr, "CFLR", "Autoconverted. TODO: document me.");
+       CtdlRegisterProtoHook(cmd_kflr, "KFLR", "Autoconverted. TODO: document me.");
+       CtdlRegisterProtoHook(cmd_eflr, "EFLR", "Autoconverted. TODO: document me.");
+        /* return our Subversion id for the Log */
+       return "$Id$";
+}