X-Git-Url: https://www.fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;f=mymail.c;h=7394c71f099a60e5eae559e1e3a58e1c213756fd;hb=2067ba7cc3ac7a412c2ba633cb71dc2ecfcb28ce;hp=fd3b4f5c88d80a28b7b9aa99792494bd279cd65e;hpb=a5c88357a01aeb45d646f0e70891fbed394e5344;p=mymail.git diff --git a/mymail.c b/mymail.c index fd3b4f5..7394c71 100644 --- a/mymail.c +++ b/mymail.c @@ -21,11 +21,13 @@ /* - This command is a dumb mail indexer. It can either (1) scan - directories containing mbox files, and create a db file containing - for each mail a list of fields computed from the header, or (2) - read such a db file and get all the mails matching regexp-defined - conditions on the fields, to create a resulting mbox file. + mymail is a simple mail indexer. It can: + + (1) scan mbox files, and create a db file containing for each mail a + list of fields computed from its header. + + (2) read such a db file, gets all the mails matching regexp-defined + conditions on the fields, and generates a resulting mbox file. It is low-tech, simple, light and fast. @@ -84,6 +86,9 @@ enum { ID_PARTICIPANT, ID_BODY, ID_TIME_INTERVAL, + ID_MAIL_ID, + ID_REFERENCE_ID, + ID_THREAD_ID, MAX_ID }; @@ -96,7 +101,10 @@ static char *field_keys[] = { "date", "part", "body", - "interval" + "interval", + "mailid", + "reference", + "thread" }; /********************************************************************/ @@ -153,6 +161,20 @@ static struct parsable_field fields_to_parse[] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, + { + ID_MAIL_ID, + REG_ICASE, + "^message-id: ", + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } + }, + + { + ID_REFERENCE_ID, + REG_ICASE, + "^\\(in-reply-to\\|references\\): ", + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } + }, + }; /********************************************************************/ @@ -293,6 +315,10 @@ int db_line_match_search(struct search_condition *condition, (condition->db_key == ID_FROM && db_key == ID_LEADING_LINE) + || + + (condition->db_key == ID_THREAD_ID && (db_key == ID_MAIL_ID || + db_key == ID_REFERENCE_ID)) ) && @@ -1152,6 +1178,16 @@ int main(int argc, char **argv) { } } + if(error) { + print_usage(stderr); + exit(EXIT_FAILURE); + } + + if(show_help) { + print_usage(stdout); + exit(EXIT_SUCCESS); + } + /* Set all the values that may defined in the arguments, through environment variables, or hard-coded */ @@ -1175,18 +1211,6 @@ int main(int argc, char **argv) { "MYMAIL_MBOX_PATTERN", 0); - /* Start the processing */ - - if(error) { - print_usage(stderr); - exit(EXIT_FAILURE); - } - - if(show_help) { - print_usage(stdout); - exit(EXIT_SUCCESS); - } - /* mbox indexing */ if(action_index) {