mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-12-22 17:34:54 +01:00
notmuch: Add Maildir directory name as tag name for messages
This patch adds maildir directory name as the tag name for messages. This helps in adding tags using filtering already provided by procmail. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
This commit is contained in:
parent
21f3252436
commit
9794f19017
1 changed files with 10 additions and 2 deletions
|
@ -101,6 +101,7 @@ static int ino_cmp(const struct dirent **a, const struct dirent **b)
|
|||
static notmuch_status_t
|
||||
add_files_recursive (notmuch_database_t *notmuch,
|
||||
const char *path,
|
||||
const char *tag,
|
||||
struct stat *st,
|
||||
add_files_state_t *state)
|
||||
{
|
||||
|
@ -183,6 +184,7 @@ add_files_recursive (notmuch_database_t *notmuch,
|
|||
case NOTMUCH_STATUS_SUCCESS:
|
||||
state->added_messages++;
|
||||
tag_inbox_and_unread (message);
|
||||
notmuch_message_add_tag (message, tag);
|
||||
break;
|
||||
/* Non-fatal issues (go on to next file) */
|
||||
case NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID:
|
||||
|
@ -220,7 +222,13 @@ add_files_recursive (notmuch_database_t *notmuch,
|
|||
}
|
||||
}
|
||||
} else if (S_ISDIR (st->st_mode)) {
|
||||
status = add_files_recursive (notmuch, next, st, state);
|
||||
if ((strcmp (entry->d_name, "cur") == 0) ||
|
||||
(strcmp (entry->d_name, "new") == 0) ||
|
||||
(strcmp (entry->d_name, "tmp") == 0)) {
|
||||
status = add_files_recursive (notmuch, next, tag, st, state);
|
||||
} else {
|
||||
status = add_files_recursive (notmuch, next, entry->d_name, st, state);
|
||||
}
|
||||
if (status && ret == NOTMUCH_STATUS_SUCCESS)
|
||||
ret = status;
|
||||
}
|
||||
|
@ -284,7 +292,7 @@ add_files (notmuch_database_t *notmuch,
|
|||
timerval.it_value.tv_usec = 0;
|
||||
setitimer (ITIMER_REAL, &timerval, NULL);
|
||||
|
||||
status = add_files_recursive (notmuch, path, &st, state);
|
||||
status = add_files_recursive (notmuch, path, basename(path), &st, state);
|
||||
|
||||
/* Now stop the timer. */
|
||||
timerval.it_interval.tv_sec = 0;
|
||||
|
|
Loading…
Reference in a new issue