Added the "year" criterion.
[mymail.git] / mymail.c
index dd84dbe..fe2d9a0 100644 (file)
--- a/mymail.c
+++ b/mymail.c
@@ -117,7 +117,7 @@ static struct parsable_field fields_to_parse[] = {
   {
     ID_FROM,
     REG_ICASE,
-    "^\\(from:\\|reply-to:\\|sender:\\|return-path:\\)",
+    "^\\(from\\|reply-to\\|sender\\|return-path\\): ",
     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
   },
 
@@ -292,7 +292,9 @@ int mbox_line_match_search(struct search_condition *condition,
        (condition->field_id == ID_FROM && mbox_id == ID_LEADING_LINE)
 
        )
+
       &&
+
       regexec(&condition->regexp, mbox_value, 0, 0, 0) == 0;
   }
 }
@@ -731,6 +733,13 @@ void init_condition(struct search_condition *condition, char *full_string) {
     condition->interval_stop = 0;
   }
 
+  else if(strcmp(search_field, "24h") == 0 ||
+          strcmp(search_field, "today") == 0) {
+    condition->field_id = ID_INTERVAL;
+    condition->interval_start = time(0) - 3600 * 24;
+    condition->interval_stop = 0;
+  }
+
   else if(strcmp(search_field, "week") == 0) {
     condition->field_id = ID_INTERVAL;
     condition->interval_start = time(0) - 3600 * 24 * 7;
@@ -743,10 +752,9 @@ void init_condition(struct search_condition *condition, char *full_string) {
     condition->interval_stop = 0;
   }
 
-  else if(strcmp(search_field, "24h") == 0 ||
-          strcmp(search_field, "today") == 0) {
+  else if(strcmp(search_field, "year") == 0) {
     condition->field_id = ID_INTERVAL;
-    condition->interval_start = time(0) - 3600 * 24;
+    condition->interval_start = time(0) - 3600 * 24 * 365;
     condition->interval_stop = 0;
   }