* Renamed "struct user" to "struct ctdluser"
[citadel.git] / citadel / serv_vandelay.c
index bd613e0c0cd544d2f40fa534c248207bfb7907ad..4b54fe582c16b1fa37b7d93136ac070a8d0574ce 100644 (file)
@@ -36,7 +36,7 @@
 #include "citserver.h"
 #include "support.h"
 #include "config.h"
-#include "dynloader.h"
+#include "serv_extensions.h"
 #include "database.h"
 #include "msgbase.h"
 #include "tools.h"
@@ -50,22 +50,21 @@ char artv_tempfilename1[PATH_MAX];
 char artv_tempfilename2[PATH_MAX];
 FILE *artv_global_message_list;
 
-void artv_export_users_backend(struct usersupp *usbuf, void *data) {
+void artv_export_users_backend(struct ctdluser *usbuf, void *data) {
        cprintf("user\n");
        cprintf("%d\n", usbuf->version);
-       cprintf("%d\n", usbuf->uid);
+       cprintf("%ld\n", (long)usbuf->uid);
        cprintf("%s\n", usbuf->password);
        cprintf("%u\n", usbuf->flags);
        cprintf("%ld\n", usbuf->timescalled);
        cprintf("%ld\n", usbuf->posted);
        cprintf("%d\n", usbuf->axlevel);
        cprintf("%ld\n", usbuf->usernum);
-       cprintf("%ld\n", usbuf->lastcall);
+       cprintf("%ld\n", (long)usbuf->lastcall);
        cprintf("%d\n", usbuf->USuserpurge);
        cprintf("%s\n", usbuf->fullname);
        cprintf("%d\n", usbuf->USscreenwidth);
        cprintf("%d\n", usbuf->USscreenheight);
-       cprintf("%d\n", usbuf->moderation_filter);
 }
 
 
@@ -80,28 +79,30 @@ void artv_export_room_msg(long msgnum, void *userdata) {
 }
 
 
-void artv_export_rooms_backend(struct quickroom *qrbuf, void *data) {
+void artv_export_rooms_backend(struct ctdlroom *qrbuf, void *data) {
        cprintf("room\n");
        cprintf("%s\n", qrbuf->QRname);
        cprintf("%s\n", qrbuf->QRpasswd);
        cprintf("%ld\n", qrbuf->QRroomaide);
        cprintf("%ld\n", qrbuf->QRhighest);
-       cprintf("%ld\n", qrbuf->QRgen);
+       cprintf("%ld\n", (long)qrbuf->QRgen);
        cprintf("%u\n", qrbuf->QRflags);
        cprintf("%s\n", qrbuf->QRdirname);
        cprintf("%ld\n", qrbuf->QRinfo);
        cprintf("%d\n", qrbuf->QRfloor);
-       cprintf("%ld\n", qrbuf->QRmtime);
+       cprintf("%ld\n", (long)qrbuf->QRmtime);
        cprintf("%d\n", qrbuf->QRep.expire_mode);
        cprintf("%d\n", qrbuf->QRep.expire_value);
        cprintf("%ld\n", qrbuf->QRnumber);
        cprintf("%d\n", qrbuf->QRorder);
+       cprintf("%u\n", qrbuf->QRflags2);
+       cprintf("%d\n", qrbuf->QRdefaultview);
 
-       getroom(&CC->quickroom, qrbuf->QRname);
+       getroom(&CC->room, qrbuf->QRname);
        /* format of message list export is all message numbers output
         * one per line terminated by a 0.
         */
-       CtdlForEachMessage(MSGS_ALL, 0L, (-127), NULL, NULL,
+       CtdlForEachMessage(MSGS_ALL, 0L, NULL, NULL,
                artv_export_room_msg, NULL);
        cprintf("0\n");
 
@@ -121,9 +122,9 @@ void artv_export_rooms(void) {
         * this will be handled by exporting the reference count, not by
         * exporting the message multiple times.)
         */
-       sprintf(cmd, "sort <%s >%s", artv_tempfilename1, artv_tempfilename2);
+       snprintf(cmd, sizeof cmd, "sort <%s >%s", artv_tempfilename1, artv_tempfilename2);
        system(cmd);
-       sprintf(cmd, "uniq <%s >%s", artv_tempfilename2, artv_tempfilename1);
+       snprintf(cmd, sizeof cmd, "uniq <%s >%s", artv_tempfilename2, artv_tempfilename1);
        system(cmd);
 }
 
@@ -177,12 +178,13 @@ void artv_export_visits(void) {
                }
 
                cprintf("%u\n", vbuf.v_flags);
+               cprintf("%d\n", vbuf.v_view);
        }
 }
 
 
 void artv_export_message(long msgnum) {
-       struct SuppMsgInfo smi;
+       struct MetaData smi;
        struct CtdlMessage *msg;
        struct ser_ret smr;
        FILE *fp;
@@ -193,18 +195,17 @@ void artv_export_message(long msgnum) {
        if (msg == NULL) return;        /* fail silently */
 
        cprintf("message\n");
-       GetSuppMsgInfo(&smi, msgnum);
+       GetMetaData(&smi, msgnum);
        cprintf("%ld\n", msgnum);
-       cprintf("%d\n", smi.smi_refcount);
-       cprintf("%s\n", smi.smi_content_type);
-       cprintf("%d\n", smi.smi_mod);
+       cprintf("%d\n", smi.meta_refcount);
+       cprintf("%s\n", smi.meta_content_type);
 
        serialize_message(&smr, msg);
        CtdlFreeMessage(msg);
 
        /* write it in base64 */
        strcpy(tempfile, tmpnam(NULL));
-       sprintf(buf, "./base64 -e >%s", tempfile);
+       snprintf(buf, sizeof buf, "./base64 -e >%s", tempfile);
        fp = popen(buf, "w");
        fwrite(smr.ser, smr.len, 1, fp);
        pclose(fp);
@@ -238,7 +239,7 @@ void artv_export_messages(void) {
                }
        }
        fclose(artv_global_message_list);
-       lprintf(7, "Exported %ld messages.\n", count);
+       lprintf(7, "Exported %d messages.\n", count);
 }
 
 
@@ -255,7 +256,7 @@ void artv_do_export(void) {
        cprintf("%s\n", config.c_fqdn);
        cprintf("%s\n", config.c_humannode);
        cprintf("%s\n", config.c_phonenum);
-       cprintf("%d\n", config.c_bbsuid);
+       cprintf("%ld\n", (long)config.c_bbsuid);
        cprintf("%d\n", config.c_creataide);
        cprintf("%d\n", config.c_sleeping);
        cprintf("%d\n", config.c_initax);
@@ -264,10 +265,8 @@ void artv_do_export(void) {
        cprintf("%s\n", config.c_twitroom);
        cprintf("%s\n", config.c_moreprompt);
        cprintf("%d\n", config.c_restrict);
-       cprintf("%ld\n", config.c_msgbase);
        cprintf("%s\n", config.c_bbs_city);
        cprintf("%s\n", config.c_sysadm);
-       cprintf("%s\n", config.c_bucket_dir);
        cprintf("%d\n", config.c_setup_level);
        cprintf("%d\n", config.c_maxsessions);
        cprintf("%s\n", config.c_net_password);
@@ -284,7 +283,6 @@ void artv_do_export(void) {
        cprintf("%d\n", config.c_max_workers);
        cprintf("%d\n", config.c_pop3_port);
        cprintf("%d\n", config.c_smtp_port);
-       cprintf("%d\n", config.c_default_filter);
 
        /* Export the control file */
        get_control();
@@ -324,11 +322,9 @@ void artv_import_config(void) {
        client_gets(config.c_twitroom);
        client_gets(config.c_moreprompt);
        client_gets(buf);       config.c_restrict = atoi(buf);
-       client_gets(buf);       config.c_msgbase = atol(buf);
        client_gets(config.c_bbs_city);
        client_gets(config.c_sysadm);
        lprintf(9, "c_sysadm = %s\n", config.c_sysadm);
-       client_gets(config.c_bucket_dir);
        client_gets(buf);       config.c_setup_level = atoi(buf);
        client_gets(buf);       config.c_maxsessions = atoi(buf);
        client_gets(config.c_net_password);
@@ -345,7 +341,6 @@ void artv_import_config(void) {
        client_gets(buf);       config.c_max_workers = atoi(buf);
        client_gets(buf);       config.c_pop3_port = atoi(buf);
        client_gets(buf);       config.c_smtp_port = atoi(buf);
-       client_gets(buf);       config.c_default_filter = atoi(buf);
        put_config();
        lprintf(7, "Imported config file\n");
 }
@@ -368,7 +363,7 @@ void artv_import_control(void) {
 
 void artv_import_user(void) {
        char buf[SIZ];
-       struct usersupp usbuf;
+       struct ctdluser usbuf;
 
        client_gets(buf);       usbuf.version = atoi(buf);
        client_gets(buf);       usbuf.uid = atoi(buf);
@@ -383,14 +378,13 @@ void artv_import_user(void) {
        client_gets(usbuf.fullname);
        client_gets(buf);       usbuf.USscreenwidth = atoi(buf);
        client_gets(buf);       usbuf.USscreenheight = atoi(buf);
-       client_gets(buf);       usbuf.moderation_filter = atoi(buf);
        putuser(&usbuf);
 }
 
 
 void artv_import_room(void) {
        char buf[SIZ];
-       struct quickroom qrbuf;
+       struct ctdlroom qrbuf;
        long msgnum;
        int msgcount = 0;
 
@@ -408,6 +402,8 @@ void artv_import_room(void) {
        client_gets(buf);       qrbuf.QRep.expire_value = atoi(buf);
        client_gets(buf);       qrbuf.QRnumber = atol(buf);
        client_gets(buf);       qrbuf.QRorder = atoi(buf);
+       client_gets(buf);       qrbuf.QRflags2 = atoi(buf);
+       client_gets(buf);       qrbuf.QRdefaultview = atoi(buf);
        putroom(&qrbuf);
        lprintf(7, "Imported room <%s>\n", qrbuf.QRname);
        /* format of message list export is all message numbers output
@@ -455,6 +451,7 @@ void artv_import_visit(void) {
        if (is_textual_seen)    strcpy(vbuf.v_seen, buf);
 
        client_gets(buf);       vbuf.v_flags = atoi(buf);
+       client_gets(buf);       vbuf.v_view = atoi(buf);
        put_visit(&vbuf);
        lprintf(7, "Imported visit %ld/%ld/%ld\n",
                vbuf.v_roomnum, vbuf.v_roomgen, vbuf.v_usernum);
@@ -463,26 +460,25 @@ void artv_import_visit(void) {
 
 
 void artv_import_message(void) {
-       struct SuppMsgInfo smi;
+       struct MetaData smi;
        long msgnum;
-       int msglen;
+       long msglen;
        FILE *fp;
        char buf[SIZ];
        char tempfile[SIZ];
        char *mbuf;
 
-       memset(&smi, 0, sizeof(struct SuppMsgInfo));
+       memset(&smi, 0, sizeof(struct MetaData));
        client_gets(buf);       msgnum = atol(buf);
-                               smi.smi_msgnum = msgnum;
-       client_gets(buf);       smi.smi_refcount = atoi(buf);
-       client_gets(smi.smi_content_type);
-       client_gets(buf);       smi.smi_mod = atoi(buf);
+                               smi.meta_msgnum = msgnum;
+       client_gets(buf);       smi.meta_refcount = atoi(buf);
+       client_gets(smi.meta_content_type);
 
        lprintf(7, "message #%ld\n", msgnum);
 
        /* decode base64 message text */
        strcpy(tempfile, tmpnam(NULL));
-       sprintf(buf, "./base64 -d >%s", tempfile);
+       snprintf(buf, sizeof buf, "./base64 -d >%s", tempfile);
        fp = popen(buf, "w");
        while (client_gets(buf), strcasecmp(buf, END_OF_MESSAGE)) {
                fprintf(fp, "%s\n", buf);
@@ -504,7 +500,7 @@ void artv_import_message(void) {
        phree(mbuf);
        unlink(tempfile);
 
-       PutSuppMsgInfo(&smi);
+       PutMetaData(&smi);
        lprintf(7, "Imported message %ld\n", msgnum);
 }
 
@@ -524,7 +520,7 @@ void artv_do_import(void) {
                if (!strcasecmp(buf, "version")) {
                        client_gets(s_version);
                        version = atoi(s_version);
-                       if ((version < REV_MIN) || (version > REV_LEVEL)) {
+                       if ((version<EXPORT_REV_MIN) || (version>REV_LEVEL)) {
                                lprintf(7, "Version mismatch - aborting\n");
                                break;
                        }
@@ -574,7 +570,7 @@ void cmd_artv(char *cmdbuf) {
 
 
 
-char *Dynamic_Module_Init(void)
+char *serv_vandelay_init(void)
 {
        CtdlRegisterProtoHook(cmd_artv, "ARTV", "import/export data store");
        return "$Id$";