mirror of https://github.com/djcb/mu.git
* mu-index: cosmetics
This commit is contained in:
parent
979887a36e
commit
b267cb95e0
|
@ -79,15 +79,16 @@ 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, time_t filestamp,
|
||||||
MuIndexCallbackData *data, gboolean *updated)
|
MuIndexCallbackData *data, gboolean *updated)
|
||||||
{
|
{
|
||||||
MuMsgGMime *msg;
|
MuMsgGMime *msg;
|
||||||
|
|
||||||
*updated = FALSE;
|
*updated = FALSE;
|
||||||
|
|
||||||
if (!data->_reindex && (size_t)filestamp <= (size_t)data->_dirstamp)
|
if (!data->_reindex)
|
||||||
return MU_OK;
|
if ((size_t)filestamp <= (size_t)data->_dirstamp)
|
||||||
|
return MU_OK;
|
||||||
|
|
||||||
msg = mu_msg_gmime_new (fullpath);
|
msg = mu_msg_gmime_new (fullpath);
|
||||||
if (!msg) {
|
if (!msg) {
|
||||||
|
@ -110,7 +111,7 @@ insert_or_update_maybe (const char* fullpath, time_t filestamp,
|
||||||
}
|
}
|
||||||
|
|
||||||
static MuResult
|
static MuResult
|
||||||
run_msg_callback_maybe (MuIndexCallbackData *data)
|
_run_msg_callback_maybe (MuIndexCallbackData *data)
|
||||||
{
|
{
|
||||||
if (data && data->_idx_msg_cb) {
|
if (data && data->_idx_msg_cb) {
|
||||||
|
|
||||||
|
@ -132,13 +133,13 @@ on_run_maildir_msg (const char* fullpath, time_t filestamp,
|
||||||
MuResult result;
|
MuResult result;
|
||||||
gboolean updated;
|
gboolean updated;
|
||||||
|
|
||||||
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, filestamp, data,
|
||||||
&updated);
|
&updated);
|
||||||
|
|
||||||
/* update statistics */
|
/* update statistics */
|
||||||
if (data && data->_stats) {
|
if (data && data->_stats) {
|
||||||
|
@ -162,13 +163,19 @@ on_run_maildir_dir (const char* fullpath, gboolean enter,
|
||||||
/* xapian stores a per-dir timestamp; we use this timestamp
|
/* xapian stores a per-dir timestamp; we use this timestamp
|
||||||
* to determine whether a message is up-to-data
|
* to determine whether a message is up-to-data
|
||||||
*/
|
*/
|
||||||
if (enter)
|
if (enter) {
|
||||||
data->_dirstamp =
|
data->_dirstamp =
|
||||||
mu_store_xapian_get_timestamp (data->_xapian,
|
mu_store_xapian_get_timestamp (data->_xapian,
|
||||||
fullpath);
|
fullpath);
|
||||||
else
|
g_debug ("entering %s; timestamp == %u",
|
||||||
|
fullpath, (unsigned)data->_dirstamp);
|
||||||
|
} else {
|
||||||
|
time_t now = time (NULL);
|
||||||
mu_store_xapian_set_timestamp (data->_xapian, fullpath,
|
mu_store_xapian_set_timestamp (data->_xapian, fullpath,
|
||||||
time(NULL));
|
now);
|
||||||
|
g_debug ("leaving %s; timestamp = %u",
|
||||||
|
fullpath, (unsigned)data->_dirstamp);
|
||||||
|
}
|
||||||
|
|
||||||
if (data->_idx_dir_cb)
|
if (data->_idx_dir_cb)
|
||||||
return data->_idx_dir_cb (fullpath, enter,
|
return data->_idx_dir_cb (fullpath, enter,
|
||||||
|
|
Loading…
Reference in New Issue