src/strip.vala
authorAlan Knowles <alan@roojs.com>
Wed, 9 May 2018 09:06:06 +0000 (17:06 +0800)
committerAlan Knowles <alan@roojs.com>
Wed, 9 May 2018 09:06:06 +0000 (17:06 +0800)
src/strip.vala

index 1b43755..71351d6 100644 (file)
@@ -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;
+                       }
+                       
                }