src/strip.vala
[app.mailtrimmer] / src / strip.vala
index 62ba249..d95f95c 100644 (file)
@@ -667,7 +667,7 @@ public class Strip : GLib.Object {
                        }
                        
                        var newest = new  DateTime.now_local();
-                       newest = oldest.add_months(-1 * StripApplication.opt_age_newest);
+                       newest = newest.add_months(-1 * StripApplication.opt_age_newest);
                        tspan = mailtime.difference(newest) / GLib.TimeSpan.DAY;
                        if (tspan > 0) {
                                GLib.debug("skip file is %d days newer than %d months", (int)tspan, StripApplication.opt_age_newest);
@@ -754,14 +754,14 @@ public class Strip : GLib.Object {
                oldest = oldest.add_months(-1 * StripApplication.opt_age_oldest);
                var rtspan = oldest.difference(oldest) / GLib.TimeSpan.DAY;
 
-               if (rtspan > 0) {
+               if (rtspan < 0) {
                        GLib.debug("skip(2) file is %d days older than %d months", (int)rtspan, StripApplication.opt_age_oldest);
                        return;
                }
                var newest = new  DateTime.now_local();
-               newest = oldest.add_months(-1 * StripApplication.opt_age_newest);
+               newest = newest.add_months(-1 * StripApplication.opt_age_newest);
                rtspan = mailtime.difference(newest) / GLib.TimeSpan.DAY;
-               if (rtspan < 0) {
+               if (rtspan > 0) {
                        GLib.debug("skip(2) file is %d days newer than %d months : %s", (int)rtspan, StripApplication.opt_age_newest,
                                mailtime.format("%Y-%m-%d %H:%M:%S"));
                        return;
@@ -898,11 +898,11 @@ public class Strip : GLib.Object {
                                GLib.debug("Skip directory %s is newer than min year: %d", subpath, newest.get_year());
                                return;
                        }
-                       if (year == newest.get_year() &&  month < newest.get_month()) {
+                       if (year == newest.get_year() &&  month != 999 && month > newest.get_month()) {
                                GLib.debug("Skip directory %s is newer than min year: %d/%d", subpath, newest.get_year() , newest.get_month() );
                                return;
                        }
-               if (year == newest.get_year() &&  month == newest.get_month() && day < newest.get_day_of_month()) {
+               if (year == newest.get_year() &&  month == newest.get_month() day  != 999 &&  day > newest.get_day_of_month()) {
                                GLib.debug("Skip directory %s is newer than min year: %d/%d/%d", subpath, newest.get_year() , newest.get_month(), newest.get_day_of_month() );          
                                return;
                        }