#include <pwd.h>
#include <errno.h>
#include <sys/types.h>
-#include <sys/time.h>
+
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+
#include <sys/wait.h>
#include <string.h>
+#include <ctype.h>
#include <limits.h>
#include "citadel.h"
#include "server.h"
-#include <time.h>
#include "sysdep_decls.h"
#include "citserver.h"
#include "support.h"
void artv_export_users_backend(struct usersupp *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("%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);
/* format of message list export is all message numbers output
* 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);
}
struct visit vbuf;
struct cdbdata *cdbv;
- cdb_begin_transaction();
cdb_rewind(CDB_VISIT);
while (cdbv = cdb_next_item(CDB_VISIT), cdbv != NULL) {
cprintf("%ld\n", vbuf.v_roomnum);
cprintf("%ld\n", vbuf.v_roomgen);
cprintf("%ld\n", vbuf.v_usernum);
- cprintf("%ld\n", vbuf.v_lastseen);
+
+ if (strlen(vbuf.v_seen) > 0) {
+ cprintf("%s\n", vbuf.v_seen);
+ }
+ else {
+ cprintf("%ld\n", vbuf.v_lastseen);
+ }
+
cprintf("%u\n", vbuf.v_flags);
+ cprintf("%d\n", vbuf.v_view);
}
- cdb_end_transaction();
}
void artv_export_message(long msgnum) {
- struct SuppMsgInfo smi;
+ struct MetaData smi;
struct CtdlMessage *msg;
struct ser_ret smr;
FILE *fp;
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);
+ cprintf("%d\n", smi.meta_mod);
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);
}
}
fclose(artv_global_message_list);
- lprintf(7, "Exported %ld messages.\n", count);
+ lprintf(7, "Exported %d messages.\n", count);
}
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);
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
void artv_import_visit(void) {
struct visit vbuf;
char buf[SIZ];
+ int i;
+ int is_textual_seen = 0;
client_gets(buf); vbuf.v_roomnum = atol(buf);
client_gets(buf); vbuf.v_roomgen = atol(buf);
client_gets(buf); vbuf.v_usernum = atol(buf);
- client_gets(buf); vbuf.v_lastseen = atol(buf);
+
+ client_gets(buf);
+ vbuf.v_lastseen = atol(buf);
+ for (i=0; i<strlen(buf); ++i) if (!isdigit(buf[i])) is_textual_seen = 1;
+ 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);
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);
+ client_gets(buf); smi.meta_mod = atoi(buf);
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);
phree(mbuf);
unlink(tempfile);
- PutSuppMsgInfo(&smi);
+ PutMetaData(&smi);
lprintf(7, "Imported message %ld\n", msgnum);
}