From: Francois Fleuret Date: Mon, 4 Feb 2013 11:16:17 +0000 (+0100) Subject: Now index the first line separately, still takes it into account for 'from' search. X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=12e136ba5dbcecd245a26b8a0e92619b77631285;p=mymail.git Now index the first line separately, still takes it into account for 'from' search. --- diff --git a/mymail.c b/mymail.c index 692e0a3..d8cf2c7 100644 --- a/mymail.c +++ b/mymail.c @@ -65,6 +65,7 @@ int quiet; enum { ID_MAIL = 0, + ID_FIRST_LINE, ID_FROM, ID_TO, ID_SUBJECT, @@ -76,6 +77,7 @@ enum { static char *field_names[] = { "mail", + "first", "from", "to", "subject", @@ -101,9 +103,15 @@ struct parsable_field { }; static struct parsable_field fields_to_parse[] = { + { + ID_FIRST_LINE, + "^From ", + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } + }, + { ID_FROM, - "^\\(From \\|[Ff][Rr][Oo][Mm]:\\|[R][r][E][e][P][p][L][l][Y][y]-[T][t][O][o]:\\)", + "^\\([Ff][Rr][Oo][Mm]:\\|[Rr][Ee][Pp][Ll][Yy]-[Tt][Oo]:\\|[Ss][Ee][Nn][Dd][Ee][Rr]:\\)", { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, @@ -206,7 +214,8 @@ int mbox_line_match_search(struct search_condition *condition, int mbox_id, char *mbox_value) { return (condition->field_id == mbox_id || - (condition->field_id == ID_PARTICIPANT && (mbox_id == ID_FROM || mbox_id == ID_TO))) + (condition->field_id == ID_PARTICIPANT && (mbox_id == ID_FROM || mbox_id == ID_TO)) || + (condition->field_id == ID_FROM && mbox_id == ID_FIRST_LINE)) && regexec(&condition->regexp, mbox_value, 0, 0, 0) == 0; }