]> code.citadel.org Git - citadel.git/blobdiff - citadel/serv_vandelay.c
MSGS command can now do full text search on the room
[citadel.git] / citadel / serv_vandelay.c
index d5f9340ba883a25ea05e06e42dc72af1e42417ae..730eee13ce20f02dc82aa75d191360998da0748c 100644 (file)
@@ -43,6 +43,7 @@
 #include "user_ops.h"
 #include "room_ops.h"
 #include "control.h"
+#include "euidindex.h"
 
 #define END_OF_MESSAGE "---eom---dbd---"
 
@@ -102,7 +103,7 @@ void artv_export_rooms_backend(struct ctdlroom *qrbuf, void *data) {
        /* format of message list export is all message numbers output
         * one per line terminated by a 0.
         */
-       CtdlForEachMessage(MSGS_ALL, 0L, NULL, NULL,
+       CtdlForEachMessage(MSGS_ALL, 0L, NULL, NULL, NULL,
                artv_export_room_msg, NULL);
        cprintf("0\n");
 
@@ -192,7 +193,7 @@ void artv_export_message(long msgnum) {
        struct ser_ret smr;
        FILE *fp;
        char buf[SIZ];
-       char tempfile[SIZ];
+       char tempfile[PATH_MAX];
 
        msg = CtdlFetchMessage(msgnum, 1);
        if (msg == NULL) return;        /* fail silently */
@@ -207,7 +208,7 @@ void artv_export_message(long msgnum) {
        CtdlFreeMessage(msg);
 
        /* write it in base64 */
-       strcpy(tempfile, tmpnam(NULL));
+       CtdlMakeTempFileName(tempfile, sizeof tempfile);
        snprintf(buf, sizeof buf, "./base64 -e >%s", tempfile);
        fp = popen(buf, "w");
        fwrite(smr.ser, smr.len, 1, fp);
@@ -309,6 +310,9 @@ void artv_do_export(void) {
        cprintf("%d\n", config.c_disable_newu);
        cprintf("%s\n", config.c_baseroom);
        cprintf("%s\n", config.c_aideroom);
+       cprintf("%d\n", config.c_auto_cull);
+       cprintf("%d\n", config.c_instant_expunge);
+       cprintf("%d\n", config.c_allow_spoofing);
 
        /* Export the control file */
        get_control();
@@ -383,6 +387,9 @@ void artv_import_config(void) {
        client_getln(buf, sizeof buf);  config.c_disable_newu = atoi(buf);
        client_getln(config.c_baseroom, sizeof config.c_baseroom);
        client_getln(config.c_aideroom, sizeof config.c_aideroom);
+       client_getln(buf, sizeof buf);  config.c_auto_cull = atoi(buf);
+       client_getln(buf, sizeof buf);  config.c_instant_expunge = atoi(buf);
+       client_getln(buf, sizeof buf);  config.c_allow_spoofing = atoi(buf);
        config.c_enable_fulltext = 0;   /* always disable */
        put_config();
        lprintf(CTDL_INFO, "Imported config file\n");
@@ -454,7 +461,7 @@ void artv_import_room(void) {
         * one per line terminated by a 0.
         */
        while (client_getln(buf, sizeof buf), msgnum = atol(buf), msgnum > 0) {
-               CtdlSaveMsgPointerInRoom(qrbuf.QRname, msgnum, 0);
+               CtdlSaveMsgPointerInRoom(qrbuf.QRname, msgnum, 0, NULL);
                ++msgcount;
        }
        lprintf(CTDL_INFO, "(%d messages)\n", msgcount);
@@ -510,7 +517,7 @@ void artv_import_message(void) {
        long msglen;
        FILE *fp;
        char buf[SIZ];
-       char tempfile[SIZ];
+       char tempfile[PATH_MAX];
        char *mbuf;
 
        memset(&smi, 0, sizeof(struct MetaData));
@@ -522,7 +529,7 @@ void artv_import_message(void) {
        lprintf(CTDL_INFO, "message #%ld\n", msgnum);
 
        /* decode base64 message text */
-       strcpy(tempfile, tmpnam(NULL));
+       CtdlMakeTempFileName(tempfile, sizeof tempfile);
        snprintf(buf, sizeof buf, "./base64 -d >%s", tempfile);
        fp = popen(buf, "w");
        while (client_getln(buf, sizeof buf), strcasecmp(buf, END_OF_MESSAGE)) {
@@ -584,6 +591,7 @@ void artv_do_import(void) {
        }
        lprintf(CTDL_INFO, "Invalid keyword <%s>.  Flushing input.\n", buf);
        while (client_getln(buf, sizeof buf), strcmp(buf, "000"))  ;;
+       rebuild_euid_index();
 }
 
 
@@ -600,8 +608,8 @@ void cmd_artv(char *cmdbuf) {
        }
        is_running = 1;
 
-       strcpy(artv_tempfilename1, tmpnam(NULL));
-       strcpy(artv_tempfilename2, tmpnam(NULL));
+       CtdlMakeTempFileName(artv_tempfilename1, sizeof artv_tempfilename1);
+       CtdlMakeTempFileName(artv_tempfilename2, sizeof artv_tempfilename2);
 
        extract_token(cmd, cmdbuf, 0, '|', sizeof cmd);
        if (!strcasecmp(cmd, "export")) artv_do_export();