mirror of https://github.com/djcb/mu.git
* mu-cmd support clearlinks / mu_maildir_clear_links
This commit is contained in:
parent
b94c4ae659
commit
877be154d0
15
src/mu-cmd.c
15
src/mu-cmd.c
|
@ -125,8 +125,6 @@ _sort_field_from_string (const char* fieldstr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
_print_rows (MuQueryXapian *xapian, const gchar *query, MuConfigOptions *opts)
|
_print_rows (MuQueryXapian *xapian, const gchar *query, MuConfigOptions *opts)
|
||||||
{
|
{
|
||||||
|
@ -194,12 +192,17 @@ _do_output_text (MuQueryXapian *xapian, MuConfigOptions* opts,
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* create a linksdir if it not exist yet; if it already existed,
|
||||||
|
* remove old links if opts->clearlinks was specified */
|
||||||
static gboolean
|
static gboolean
|
||||||
_create_linkdir_if_nonexistant (const gchar* linkdir)
|
_create_or_clear_linksdir_maybe (MuConfigOptions* opts)
|
||||||
{
|
{
|
||||||
if (access (linkdir, F_OK) != 0)
|
if (access (opts->linksdir, F_OK) != 0) {
|
||||||
if (!mu_maildir_mkmdir (linkdir, 0700, TRUE))
|
if (!mu_maildir_mkmdir (opts->linksdir, 0700, TRUE))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
} else if (opts->clearlinks)
|
||||||
|
mu_maildir_clear_links (opts->linksdir);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -213,7 +216,7 @@ _do_output_links (MuQueryXapian *xapian, MuConfigOptions* opts,
|
||||||
MuMsgXapian *row;
|
MuMsgXapian *row;
|
||||||
const MuMsgField *pathfield;
|
const MuMsgField *pathfield;
|
||||||
|
|
||||||
if (!_create_linkdir_if_nonexistant (opts->linksdir))
|
if (!_create_or_clear_linksdir_maybe (opts))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
query = mu_query_xapian_combine (params, FALSE);
|
query = mu_query_xapian_combine (params, FALSE);
|
||||||
|
|
Loading…
Reference in New Issue