// If the msgnum is negative, we are looking at METADATA
if (in_msgnum < 0) {
struct MetaData *meta = (struct MetaData *)in_data->data;
- printf("msgmeta|%ld|%d|%s|%ld\n", meta->meta_msgnum, meta->meta_refcount, meta->meta_content_type, meta->meta_rfc822_length);
+ printf("msgmeta|%ld|%d|%s|%ld\n",
+ meta->meta_msgnum,
+ meta->meta_refcount,
+ meta->meta_content_type,
+ meta->meta_rfc822_length
+ );
}
// If the msgnum is positive, we are looking at a MESSAGE
struct ctdluser *user = (struct ctdluser *)in_data->data;
printf("user|%d|%d|%s|%u|%d|%ld|%ld|%d|%s|%ld|%ld|%s|%ld|%ld\n",
- user->version, // Citadel version which created this record
- user->uid, // Associate with a unix account?
- user->password, // password
- user->flags, // See US_ flags
- user->axlevel, // Access level
- user->usernum, // User number (never recycled)
- user->lastcall, // Date/time of most recent login
- user->USuserpurge, // Purge time (in days) for user
- user->fullname, // Display name (primary identifier)
- user->msgnum_bio, // msgnum of user's profile (bio)
- user->msgnum_pic, // msgnum of user's avatar (photo)
- hexout(user->emailaddrs, strlen(user->emailaddrs)), // Internet email addresses
- user->msgnum_inboxrules, // msgnum of user's inbox filtering rules
- user->lastproc_inboxrules // msgnum of last message filtered
+ user->version,
+ user->uid,
+ user->password,
+ user->flags,
+ user->axlevel,
+ user->usernum,
+ user->lastcall,
+ user->USuserpurge,
+ user->fullname,
+ user->msgnum_bio,
+ user->msgnum_pic,
+ hexout(user->emailaddrs, strlen(user->emailaddrs)),
+ user->msgnum_inboxrules,
+ user->lastproc_inboxrules
);
}
// printf("\033[32m\033[1mBigmsg %ld , length %d\033[0m\n", out_msgnum, out_data->size);
}
+#endif
+#if 0
// export function for EUID Index records
void export_euidindex(int which_cdb, DBT *in_key, DBT *in_data, DBT *out_key, DBT *out_data) {
memcpy(out_data->data+sizeof(out_msgnum), &out_roomnum, sizeof(out_roomnum));
strcpy(out_data->data+sizeof(out_msgnum)+sizeof(out_roomnum), euid);
}
+#endif
-// convert users-by-number records
+#if 0
+// export users-by-number records
+// (This is a secondary index -- should we just regenerate the data after import?)
void export_usersbynumber(int which_cdb, DBT *in_key, DBT *in_data, DBT *out_key, DBT *out_data) {
// key is a long
// printf("usersbynumber: %ld --> %s\n", out_usernum, (char *)out_data->data);
}
+#endif
+#if 0
// export function for a config record
void export_config(int which_cdb, DBT *in_key, DBT *in_data, DBT *out_key, DBT *out_data) {
// please excuse my friend, he isn't null terminated
// printf("\033[32m\033[1mConfig entry: %s -> %s\033[0m\n", (char *)out_key->data, (char *)out_data->data+strlen(out_data->data)+1);
}
-
#endif
+
// For obsolete databases, zero all the output
void zero_function(int which_cdb, DBT *in_key, DBT *in_data) {
- //printf("Table %02x, keylen=%d, datalen=%d\n", which_cdb, in_key->size, in_data->size);
+ // do nothing
}
// Do we need to decompress?
static int32_t magic = COMPRESS_MAGIC;
compressed = 0;
- if ( (in_data.size >= sizeof(struct CtdlCompressHeader)) && (!memcmp(in_data.data, &magic, sizeof(magic))) ) {
+ if ((in_data.size >= sizeof(struct CtdlCompressHeader)) && (!memcmp(in_data.data, &magic, sizeof(magic)))) {
// yes, we need to decompress
compressed = 1;
uncomp_data.data = realloc(uncomp_data.data, uncomp_data.size);
destLen = (uLongf)comp.uncompressed_len;
- ret = uncompress((Bytef *)uncomp_data.data, (uLongf *)&destLen, (const Bytef *)in_data.data+sizeof(struct CtdlCompressHeader), (uLong)comp.compressed_len);
+ ret = uncompress((Bytef *)uncomp_data.data, (uLongf *)&destLen,
+ (const Bytef *)in_data.data+sizeof(struct CtdlCompressHeader),
+ (uLong)comp.compressed_len);
if (ret != Z_OK) {
fprintf(stderr, "db: uncompress() error %d\n", ret);
exit(CTDLEXIT_DB);
// Warn the user
fprintf(stderr, "------------------------------------------------------------------------\n");
- fprintf(stderr, "This utility must be run while the server is OFFLINE. \n");
+ fprintf(stderr, "This utility must be run while the server is NOT RUNNING. \n");
fprintf(stderr, "We \033[1mguarantee\033[0m data corruption if you do not \n");
fprintf(stderr, "observe this warning! The source [-s] directory should contain a copy \n");
fprintf(stderr, "of the database from your source system. The dump [-d] directory \n");