#include "citadel_dirs.h"
#include "threads.h"
+#include "ctdl_module.h"
+
struct floor *floorcache[MAXFLOORS];
/*
/* 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;
}
+/*
+ * Message pointer compare function for sort_msglist()
+ */
+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);
+}
+
/*
* sort message pointers
*/
int sort_msglist(long listptrs[], int oldcount)
{
- int a, b;
- long hold1, hold2;
int numitems;
numitems = oldcount;
- if (numitems < 2)
+ if (numitems < 2) {
return (oldcount);
+ }
/* do the sort */
- for (a = numitems - 2; a >= 0; --a) {
- for (b = 0; b <= a; ++b) {
- if (listptrs[b] > (listptrs[b + 1])) {
- hold1 = listptrs[b];
- hold2 = listptrs[b + 1];
- listptrs[b] = hold2;
- listptrs[b + 1] = hold1;
- }
- }
- }
+ qsort(listptrs, numitems, sizeof(long), sort_msglist_cmp);
/* and yank any nulls */
while ((numitems > 0) && (listptrs[0] == 0L)) {
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);
}
}
-void cmd_whok(void)
+void cmd_whok(char *cmdbuf)
{
struct ctdluser temp;
struct cdbdata *cdbus;
/*
* RDIR command for room directory
*/
-void cmd_rdir(void)
+void cmd_rdir(char *cmdbuf)
{
char buf[256];
char comment[256];
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);
/*
* get room parameters (aide or room aide command)
*/
-void cmd_getr(void)
+void cmd_getr(char *cmdbuf)
{
if (CtdlAccessCheck(ac_room_aide)) return;
/*
* get the name of the room aide for this room
*/
-void cmd_geta(void)
+void cmd_geta(char *cmdbuf)
{
struct ctdluser usbuf;
/*
* retrieve info file for this room
*/
-void cmd_rinf(void)
+void cmd_rinf(char *gargs)
{
char filename[128];
char buf[SIZ];
/*
* cmd_lflr() - List all known floors
*/
-void cmd_lflr(void)
+void cmd_lflr(char *gargs)
{
int a;
struct floor flbuf;
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$";
+}