Commit 98206c33 authored by Kim Vandry's avatar Kim Vandry

Merge branch 'follow_mbox_symlinks'

parents 74287c79 67f5f1b1
......@@ -57,6 +57,7 @@ static char *omit = NULL;
static char *database_path = NULL;
static enum folder_type output_folder_type = FT_MAILDIR;
static int skip_integrity_checks = 0;
static int follow_mbox_symlinks = 0;
enum filetype {
M_NONE, M_FILE, M_DIR, M_OTHER
......@@ -263,6 +264,7 @@ static void parse_rc_file(char *name)/*{{{*/
else if (!strncasecmp(p, "imap_server=", 12)) imap_server = copy_value(p);
else if (!strncasecmp(p, "imap_username=", 14)) imap_username = copy_value(p);
else if (!strncasecmp(p, "imap_password=", 14)) imap_password = copy_value(p);
else if (!strncasecmp(p, "follow_mbox_symlinks", 20)) follow_mbox_symlinks = 1;
else if (!strncasecmp(p, "omit=", 5)) add_folders(&omit, copy_value(p));
else if (!strncasecmp(p, "mformat=", 8)) {
......@@ -533,6 +535,7 @@ int main (int argc, char **argv)/*{{{*/
int do_integrity_checks = 1;
int do_forced_unlock = 0;
int do_fast_index = 0;
int do_mbox_symlinks = 0;
struct imap_ll *imapc = NULL;
unsigned int forced_hash_key = CREATE_RANDOM_DATABASE_HASH;
......@@ -661,6 +664,10 @@ int main (int argc, char **argv)/*{{{*/
do_integrity_checks = 0;
}
if (follow_mbox_symlinks) {
do_mbox_symlinks = 1;
}
if (!folder_base) {
fprintf(stderr, "No folder_base/MAIRIX_FOLDER_BASE set\n");
exit(2);
......@@ -813,7 +820,7 @@ int main (int argc, char **argv)/*{{{*/
unlock_and_exit(2);
}
build_mbox_lists(db, folder_base, mboxen, omit_globs);
build_mbox_lists(db, folder_base, mboxen, omit_globs, do_mbox_symlinks);
any_updates = update_database(db, msgs->paths, msgs->n, do_fast_index, imapc);
if (do_purge) {
......
......@@ -359,7 +359,8 @@ int cull_dead_messages(struct database *db, int do_integrity_checks);
/* In mbox.c */
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);
void compute_checksum(const char *data, size_t len, checksum_t *csum);
void cull_dead_mboxen(struct database *db);
......
......@@ -407,6 +407,14 @@ relative to the location of the
.I mairixrc
file or anything like that.)
.TP
.BI follow_mbox_symlinks
.br
This takes no arguments. By default, mairix will skip symlinks to
mboxes when indexing. If a line starting with
.B follow_mbox_symlinks
is present, mairix will follow them instead of skipping them.
.SS Expansions
The part of each line in '.mairixrc' following the equals sign can
......
......@@ -743,7 +743,8 @@ void glob_and_expand_paths(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)
{
char **raw_paths, **paths;
int n_raw_paths, i;
......@@ -776,8 +777,8 @@ void build_mbox_lists(struct database *db, const char *folder_base, /*{{{*/
if (lstat(path, &sb) < 0) {
/* can't stat */
} else {
if (S_ISLNK(sb.st_mode)) {
/* Skip mbox if symlink */
if (S_ISLNK(sb.st_mode) && !do_mbox_symlinks) {
/* Skip mbox if symlink and no follow_mbox_symlinks in mairixrc */
if (verbose) {
printf("%s is a link - skipping\n", path);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment