From: Alan Knowles Date: Wed, 9 May 2018 09:06:06 +0000 (+0800) Subject: src/strip.vala X-Git-Url: http://git.roojs.org/?a=commitdiff_plain;h=ec989321e15818af7346f3ce467096b62dac9d43;p=app.mailtrimmer src/strip.vala --- diff --git a/src/strip.vala b/src/strip.vala index 1b43755..71351d6 100644 --- a/src/strip.vala +++ b/src/strip.vala @@ -654,6 +654,16 @@ public class Strip : GLib.Object { this.created_date = this.created_dir.replace("/", "-"); var bits = this.created_date.split("-"); mailtime = new DateTime.local(int.parse(bits[0]),int.parse(bits[1]),int.parse(bits[2]),0,0,0); + + var oldest = new DateTime.now_local(); + oldest.add_months(-1 * StripApplication.opt_min_age); + var tspan = mailtime.difference(oldest) / GLib.TimeSpan.DAY; + + if (tspan < 0) { + GLib.debug("skip file is %d days older than %d months", (int)tspan, StripApplication.opt_min_age); + return; + } + }