mirror of https://github.com/djcb/mu.git
* mu-config,mu-index: rename --empty -> --rebuild, small changes for maildir stuff
This commit is contained in:
parent
8f825b4816
commit
c141d9436c
|
@ -65,8 +65,8 @@ config_options_group_index (MuConfigOptions *opts)
|
||||||
"top of the maildir", NULL},
|
"top of the maildir", NULL},
|
||||||
{"reindex", 'r', 0, G_OPTION_ARG_NONE, &opts->reindex,
|
{"reindex", 'r', 0, G_OPTION_ARG_NONE, &opts->reindex,
|
||||||
"index already indexed messages too", NULL},
|
"index already indexed messages too", NULL},
|
||||||
{"empty", 'y', 0, G_OPTION_ARG_NONE, &opts->empty,
|
{"rebuild", 'y', 0, G_OPTION_ARG_NONE, &opts->rebuild,
|
||||||
"empty the database before indexing", NULL},
|
"rebuild the database from scratch", NULL},
|
||||||
{"autoupgrade", 'u', 0, G_OPTION_ARG_NONE, &opts->autoupgrade,
|
{"autoupgrade", 'u', 0, G_OPTION_ARG_NONE, &opts->autoupgrade,
|
||||||
"automatically upgrade the database with new mu versions", NULL},
|
"automatically upgrade the database with new mu versions", NULL},
|
||||||
{"nocleanup", 'n', 0, G_OPTION_ARG_NONE, &opts->nocleanup,
|
{"nocleanup", 'n', 0, G_OPTION_ARG_NONE, &opts->nocleanup,
|
||||||
|
|
|
@ -45,7 +45,7 @@ struct _MuConfigOptions {
|
||||||
char *maildir; /* where the mails are */
|
char *maildir; /* where the mails are */
|
||||||
gboolean nocleanup; /* don't cleanup deleted mails from db */
|
gboolean nocleanup; /* don't cleanup deleted mails from db */
|
||||||
gboolean reindex; /* re-index existing mails */
|
gboolean reindex; /* re-index existing mails */
|
||||||
gboolean empty; /* empty the database before indexing */
|
gboolean rebuild; /* empty the database before indexing */
|
||||||
gboolean autoupgrade; /* automatically upgrade db
|
gboolean autoupgrade; /* automatically upgrade db
|
||||||
* when needed */
|
* when needed */
|
||||||
|
|
||||||
|
|
|
@ -93,8 +93,9 @@ typedef struct _MuIndexCallbackData MuIndexCallbackData;
|
||||||
|
|
||||||
|
|
||||||
static MuResult
|
static MuResult
|
||||||
insert_or_update_maybe (const char* fullpath, time_t filestamp,
|
insert_or_update_maybe (const char* fullpath, const char* mdir,
|
||||||
MuIndexCallbackData *data, gboolean *updated)
|
time_t filestamp,
|
||||||
|
MuIndexCallbackData *data, gboolean *updated)
|
||||||
{
|
{
|
||||||
MuMsgGMime *msg;
|
MuMsgGMime *msg;
|
||||||
|
|
||||||
|
@ -124,7 +125,7 @@ insert_or_update_maybe (const char* fullpath, time_t filestamp,
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
|
|
||||||
msg = mu_msg_gmime_new (fullpath);
|
msg = mu_msg_gmime_new (fullpath, mdir);
|
||||||
if (!msg) {
|
if (!msg) {
|
||||||
g_warning ("%s: failed to create mu_msg for %s",
|
g_warning ("%s: failed to create mu_msg for %s",
|
||||||
__FUNCTION__, fullpath);
|
__FUNCTION__, fullpath);
|
||||||
|
@ -161,8 +162,8 @@ run_msg_callback_maybe (MuIndexCallbackData *data)
|
||||||
|
|
||||||
|
|
||||||
static MuResult
|
static MuResult
|
||||||
on_run_maildir_msg (const char* fullpath, time_t filestamp,
|
on_run_maildir_msg (const char* fullpath, const char* mdir,
|
||||||
MuIndexCallbackData *data)
|
time_t filestamp, MuIndexCallbackData *data)
|
||||||
{
|
{
|
||||||
MuResult result;
|
MuResult result;
|
||||||
gboolean updated;
|
gboolean updated;
|
||||||
|
@ -170,9 +171,9 @@ on_run_maildir_msg (const char* fullpath, time_t filestamp,
|
||||||
result = run_msg_callback_maybe (data);
|
result = run_msg_callback_maybe (data);
|
||||||
if (result != MU_OK)
|
if (result != MU_OK)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
/* see if we need to update/insert anything...*/
|
/* see if we need to update/insert anything...*/
|
||||||
result = insert_or_update_maybe (fullpath, filestamp, data,
|
result = insert_or_update_maybe (fullpath, mdir, filestamp, data,
|
||||||
&updated);
|
&updated);
|
||||||
|
|
||||||
/* update statistics */
|
/* update statistics */
|
||||||
|
@ -298,7 +299,8 @@ mu_index_run (MuIndex *index, const char* path,
|
||||||
}
|
}
|
||||||
|
|
||||||
static MuResult
|
static MuResult
|
||||||
on_stats_maildir_file (const char *fullpath, time_t timestamp,
|
on_stats_maildir_file (const char *fullpath, const char* mdir,
|
||||||
|
time_t timestamp,
|
||||||
MuIndexCallbackData *cb_data)
|
MuIndexCallbackData *cb_data)
|
||||||
{
|
{
|
||||||
MuResult result;
|
MuResult result;
|
||||||
|
|
Loading…
Reference in New Issue