Added the "participant" search field.
authorFrancois Fleuret <francois@fleuret.org>
Thu, 31 Jan 2013 21:53:12 +0000 (22:53 +0100)
committerFrancois Fleuret <francois@fleuret.org>
Thu, 31 Jan 2013 21:53:12 +0000 (22:53 +0100)
mymail.c

index dcb44bf..0593f62 100644 (file)
--- a/mymail.c
+++ b/mymail.c
@@ -56,7 +56,7 @@ enum {
   ID_FROM,
   ID_DEST,
   ID_SUBJECT,
-  ID_FROMDEST,
+  ID_PARTICIPANT,
   MAX_ID
 };
 
@@ -65,7 +65,7 @@ static char *field_names[] = {
   "from",
   "dest",
   "subj",
-  "fromdest"
+  "part"
 };
 
 struct parsable_field {
@@ -143,7 +143,11 @@ int ignore_entry(const char *name) {
 
 int mbox_line_match_search(int search_id, regex_t *search_regexp,
                            int mbox_id, char *mbox_value) {
-  return search_id == mbox_id && regexec(search_regexp, mbox_value, 0, 0, 0) == 0;
+  return
+    (search_id == mbox_id ||
+     (search_id == ID_PARTICIPANT && (mbox_id == ID_FROM || mbox_id == ID_DEST)))
+    &&
+    regexec(search_regexp, mbox_value, 0, 0, 0) == 0;
 }
 
 void search_in_db(int nb_search_patterns,