}
+// Import a full text search index record.
+// It's just like a msglists record: a key and a list of message numbers, but the key is "int" instead of "long"
int import_fulltext(char *line, DBT *out_key, DBT *out_data) {
- return(0);
+ int indexnum;
+ char *token, *mtoken;
+ char *p = line;
+ char *q = NULL;
+ int num_msgs = 0;
+ long *msglist = NULL;
+
+ for (int i=0; (token = strsep(&p, "|")); ++i) {
+ switch(i) {
+ case 1:
+ indexnum = atoi(token);
+ break;
+ case 2:
+ q = token;
+ for (int j=0; (mtoken = strsep(&q, ",")); ++j) {
+ msglist = realloc(msglist, (num_msgs+1) * sizeof(long));
+ msglist[num_msgs++] = atol(mtoken);
+ }
+ break;
+ }
+ }
+
+ out_key->size = sizeof(int);
+ out_key->data = malloc(out_key->size);
+ memcpy(out_key->data, &indexnum, out_key->size);
+
+ out_data->size = num_msgs * sizeof(long);
+ out_data->data = msglist;
+
+ return(1);
}
+
+
+// Import an EUID Index record
int import_euidindex(char *line, DBT *out_key, DBT *out_data) {
return(0);
}
+
+
+// Import a "users by number" (secondary index) record
int import_usersbynumber(char *line, DBT *out_key, DBT *out_data) {
return(0);
}
-
-
// Import a config record
// The key is the config key
// The data is the config key, a null, the value, and another null