mairix.h (mairix-0.23) | : | mairix.h (mairix-0.24) | ||
---|---|---|---|---|
skipping to change at line 35 | skipping to change at line 35 | |||
#include <stdio.h> | #include <stdio.h> | |||
#include <stdlib.h> | #include <stdlib.h> | |||
#include <string.h> | #include <string.h> | |||
#include <time.h> | #include <time.h> | |||
#include <sys/types.h> | #include <sys/types.h> | |||
#include <sys/stat.h> | #include <sys/stat.h> | |||
#include "memmac.h" | #include "memmac.h" | |||
enum message_type {/*{{{*/ | ||||
MTY_DEAD, /* msg no longer exists, i.e. don't report in searches, | ||||
prune it on a '-p' run. */ | ||||
MTY_FILE, /* msg <-> file in 1-1 correspondence e.g. maildir, MH */ | ||||
MTY_MBOX, /* multiple msgs per file : MBOX format file */ | ||||
MTY_IMAP /* Message on IMAP server; syntax: uidvalidity:uid:folder */ | ||||
}; | ||||
/*}}}*/ | ||||
enum folder_type {/*{{{*/ | ||||
FT_MAILDIR, | ||||
FT_MH, | ||||
FT_MBOX, | ||||
FT_RAW, | ||||
FT_EXCERPT, | ||||
FT_IMAP | ||||
}; | ||||
/*}}}*/ | ||||
struct msgpath {/*{{{*/ | struct msgpath {/*{{{*/ | |||
/* The 'selector' for this union is the corresponding entry of type 'enum | enum message_type type; /* selector for union 'src' */ | |||
* message_type' */ | ||||
union { | union { | |||
struct { | struct { | |||
char *path; | char *path; | |||
size_t size; /* size of the message in bytes */ | size_t size; /* size of the message in bytes */ | |||
time_t mtime; /* mtime of message file on disc */ | time_t mtime; /* mtime of message file on disc */ | |||
} mpf; /* message per file */ | } mpf; /* message per file */ | |||
struct { | struct { | |||
int file_index; /* index into table of mbox files */ | int file_index; /* index into table of mbox files */ | |||
int msg_index; /* index of message within the file */ | int msg_index; /* index of message within the file */ | |||
} mbox; /* for messages in mbox format folders */ | } mbox; /* for messages in mbox format folders */ | |||
} src; | } src; | |||
/* Now fields that are common to both types of message. */ | /* Now fields that are common to both types of message. */ | |||
time_t date; /* representation of Date: header in message */ | time_t date; /* representation of Date: header in message */ | |||
int tid; /* thread-id */ | int tid; /* thread-id */ | |||
/* Track the folder type this came from, so we know the difference | ||||
between MH and Maildir, both of which have type MTY_FILE. */ | ||||
enum folder_type source_ft; | ||||
/* Message flags. */ | /* Message flags. */ | |||
unsigned int seen:1; | unsigned int seen:1; | |||
unsigned int replied:1; | unsigned int replied:1; | |||
unsigned int flagged:1; | unsigned int flagged:1; | |||
/* + other stuff eventually */ | /* + other stuff eventually */ | |||
}; | }; | |||
/*}}}*/ | /*}}}*/ | |||
enum message_type {/*{{{*/ | ||||
MTY_DEAD, /* msg no longer exists, i.e. don't report in searches, | ||||
prune it on a '-p' run. */ | ||||
MTY_FILE, /* msg <-> file in 1-1 correspondence e.g. maildir, MH */ | ||||
MTY_MBOX /* multiple msgs per file : MBOX format file */ | ||||
}; | ||||
/*}}}*/ | ||||
struct msgpath_array {/*{{{*/ | struct msgpath_array {/*{{{*/ | |||
enum message_type *type; | ||||
struct msgpath *paths; | struct msgpath *paths; | |||
int n; | int n; | |||
int max; | int max; | |||
}; | }; | |||
/*}}}*/ | /*}}}*/ | |||
struct matches {/*{{{*/ | struct matches {/*{{{*/ | |||
unsigned char *msginfo; | unsigned char *msginfo; | |||
int n; /* bytes in use */ | int n; /* bytes in use */ | |||
int max; /* bytes allocated */ | int max; /* bytes allocated */ | |||
skipping to change at line 245 | skipping to change at line 259 | |||
struct toktable *attachment_name; | struct toktable *attachment_name; | |||
/* Encoding chain 0 stores all msgids appearing in the following message heade rs: | /* Encoding chain 0 stores all msgids appearing in the following message heade rs: | |||
* Message-Id, In-Reply-To, References. Used for thread reconciliation. | * Message-Id, In-Reply-To, References. Used for thread reconciliation. | |||
* Encoding chain 1 stores just the Message-Id. Used for search by message ID . | * Encoding chain 1 stores just the Message-Id. Used for search by message ID . | |||
*/ | */ | |||
struct toktable2 *msg_ids; | struct toktable2 *msg_ids; | |||
}; | }; | |||
/*}}}*/ | /*}}}*/ | |||
enum folder_type {/*{{{*/ | ||||
FT_MAILDIR, | ||||
FT_MH, | ||||
FT_MBOX, | ||||
FT_RAW, | ||||
FT_EXCERPT | ||||
}; | ||||
/*}}}*/ | ||||
struct string_list {/*{{{*/ | struct string_list {/*{{{*/ | |||
struct string_list *next; | struct string_list *next; | |||
struct string_list *prev; | struct string_list *prev; | |||
char *data; | char *data; | |||
}; | }; | |||
/*}}}*/ | /*}}}*/ | |||
struct msg_src { | struct msg_src { | |||
enum {MS_FILE, MS_MBOX} type; | enum {MS_FILE, MS_MBOX} type; | |||
char *filename; | char *filename; | |||
skipping to change at line 353 | skipping to change at line 358 | |||
void insert_index_on_encoding(struct matches *m, int idx); | void insert_index_on_encoding(struct matches *m, int idx); | |||
void add_token2_in_file(int file_index, unsigned int hash_key, char *tok_text, s truct toktable2 *table, int add_to_chain1); | void add_token2_in_file(int file_index, unsigned int hash_key, char *tok_text, s truct toktable2 *table, int add_to_chain1); | |||
/* In db.c */ | /* In db.c */ | |||
#define CREATE_RANDOM_DATABASE_HASH 0 | #define CREATE_RANDOM_DATABASE_HASH 0 | |||
struct database *new_database(unsigned int hash_key); | struct database *new_database(unsigned int hash_key); | |||
struct database *new_database_from_file(char *db_filename, int do_integrity_chec ks); | struct database *new_database_from_file(char *db_filename, int do_integrity_chec ks); | |||
void free_database(struct database *db); | void free_database(struct database *db); | |||
void maybe_grow_message_arrays(struct database *db); | void maybe_grow_message_arrays(struct database *db); | |||
void tokenise_message(int file_index, struct database *db, struct rfc822 *msg); | void tokenise_message(int file_index, struct database *db, struct rfc822 *msg); | |||
int update_database(struct database *db, struct msgpath *sorted_paths, int n_pat | struct imap_ll; | |||
hs, int do_fast_index); | int update_database(struct database *db, struct msgpath *sorted_paths, int n_pat | |||
hs, int do_fast_index, struct imap_ll *); | ||||
void check_database_integrity(struct database *db); | void check_database_integrity(struct database *db); | |||
int cull_dead_messages(struct database *db, int do_integrity_checks); | int cull_dead_messages(struct database *db, int do_integrity_checks); | |||
/* In mbox.c */ | /* In mbox.c */ | |||
void build_mbox_lists(struct database *db, const char *folder_base, | void build_mbox_lists(struct database *db, const char *folder_base, | |||
const char *mboxen_paths, struct globber_array *omit_globs); | const char *mboxen_paths, struct globber_array *omit_globs, | |||
int do_mbox_symlinks); | ||||
int add_mbox_messages(struct database *db); | int add_mbox_messages(struct database *db); | |||
void compute_checksum(const char *data, size_t len, checksum_t *csum); | void compute_checksum(const char *data, size_t len, checksum_t *csum); | |||
void cull_dead_mboxen(struct database *db); | void cull_dead_mboxen(struct database *db); | |||
unsigned int encode_mbox_indices(unsigned int mb, unsigned int msg); | unsigned int encode_mbox_indices(unsigned int mb, unsigned int msg); | |||
void decode_mbox_indices(unsigned int index, unsigned int *mb, unsigned int *msg ); | void decode_mbox_indices(unsigned int index, unsigned int *mb, unsigned int *msg ); | |||
int verify_mbox_size_constraints(struct database *db); | int verify_mbox_size_constraints(struct database *db); | |||
void glob_and_expand_paths(const char *folder_base, char **paths_in, int n_in, c har ***paths_out, int *n_out, const struct traverse_methods *methods, struct glo bber_array *omit_globs); | void glob_and_expand_paths(const char *folder_base, char **paths_in, int n_in, c har ***paths_out, int *n_out, const struct traverse_methods *methods, struct glo bber_array *omit_globs); | |||
/* In glob.c */ | /* In glob.c */ | |||
struct globber; | struct globber; | |||
struct globber *make_globber(const char *wildstring); | struct globber *make_globber(const char *wildstring); | |||
void free_globber(struct globber *old); | void free_globber(struct globber *old); | |||
int is_glob_match(struct globber *g, const char *s); | int is_glob_match(struct globber *g, const char *s); | |||
/* In writer.c */ | /* In writer.c */ | |||
void write_database(struct database *db, char *filename, int do_integrity_checks ); | void write_database(struct database *db, char *filename, int do_integrity_checks ); | |||
/* In search.c */ | /* In search.c */ | |||
int search_top(int do_threads, int do_augment, char *database_path, char *comple te_mfolder, char **argv, enum folder_type ft, int verbose); | int search_top(int do_threads, int do_augment, char *database_path, char *comple te_mfolder, char **argv, enum folder_type ft, int verbose, const char *imap_pipe , const char *imap_server, const char *imap_username, const char *imap_password) ; | |||
/* In stats.c */ | /* In stats.c */ | |||
void get_db_stats(struct database *db); | void get_db_stats(struct database *db); | |||
/* In dates.c */ | /* In dates.c */ | |||
int scan_date_string(char *in, time_t *start, int *has_start, time_t *end, int * has_end); | int scan_date_string(char *in, time_t *start, int *has_start, time_t *end, int * has_end); | |||
/* In dumper.c */ | /* In dumper.c */ | |||
void dump_database(char *filename); | void dump_database(char *filename); | |||
End of changes. 9 change blocks. | ||||
23 lines changed or deleted | 30 lines changed or added |