From 2acc0a4abd8b818906f5cd027805f77b6a012a25 Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Fri, 8 Feb 2013 10:49:56 +0100 Subject: [PATCH] Added the "year" criterion. --- mymail.1 | 6 +++--- mymail.c | 12 +++++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/mymail.1 b/mymail.1 index 67b390b..fc4749b 100644 --- a/mymail.1 +++ b/mymail.1 @@ -98,9 +98,9 @@ mboxes completely, which can be slow. However, header conditions are checked first to read the bodies only for mails which fulfill them entirely. .TP -\fB8h\fR, \fBtoday\fR, \fB24h\fR, \fBweek\fR, and \fBmonth\fR selects -mails received respectively during the last 8, 24, 24, 7 * 24 hours or -31 * 24 hours. +\fB8h\fR, \fBtoday\fR, \fB24h\fR, \fBweek\fR, \fBmonth\fR, and +\fByear\fR selects mails received during the last 8, 24, 24, 7 * 24 +hours, 31 * 24 hours, and 365 * 24 hours respectively. .TP \fByesterday\fR selects mails received between 48h and 24h ago. .TP diff --git a/mymail.c b/mymail.c index ffc5621..fe2d9a0 100644 --- a/mymail.c +++ b/mymail.c @@ -733,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; @@ -745,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; } -- 2.20.1