projects
/
mymail.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8cee89a
)
Now index the first line separately, still takes it into account for 'from' search.
author
Francois Fleuret
<francois@fleuret.org>
Mon, 4 Feb 2013 11:16:17 +0000
(12:16 +0100)
committer
Francois Fleuret
<francois@fleuret.org>
Mon, 4 Feb 2013 11:16:17 +0000
(12:16 +0100)
mymail.c
patch
|
blob
|
history
diff --git
a/mymail.c
b/mymail.c
index
692e0a3
..
d8cf2c7
100644
(file)
--- a/
mymail.c
+++ b/
mymail.c
@@
-65,6
+65,7
@@
int quiet;
enum {
ID_MAIL = 0,
enum {
ID_MAIL = 0,
+ ID_FIRST_LINE,
ID_FROM,
ID_TO,
ID_SUBJECT,
ID_FROM,
ID_TO,
ID_SUBJECT,
@@
-76,6
+77,7
@@
enum {
static char *field_names[] = {
"mail",
static char *field_names[] = {
"mail",
+ "first",
"from",
"to",
"subject",
"from",
"to",
"subject",
@@
-101,9
+103,15
@@
struct parsable_field {
};
static struct parsable_field fields_to_parse[] = {
};
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,
{
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 }
},
{ 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 ||
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;
}
&&
regexec(&condition->regexp, mbox_value, 0, 0, 0) == 0;
}