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

index fdc12d8..e06c88a 100644 (file)
@@ -668,9 +668,10 @@ public class Strip : GLib.Object {
        } else {
                // it's a mail directory...
                // use the last modification time? as the default...
-                var dts = new DateTime.from_timeval_utc(mod_time);
-                this.created_dir = dts.format("/%Y/%m/%d");
-                        this.created_date =  dts.format("%Y-%m-%d %H:%M:%S");
+                mailtime = new DateTime.from_timeval_utc(mod_time);
+                this.created_dir = mailtime.format("/%Y/%m/%d");
+                        this.created_date =  mailtime.format("%Y-%m-%d %H:%M:%S");
+                        mailtime
        }
                // check on age of file...
                
@@ -713,17 +714,26 @@ public class Strip : GLib.Object {
                                        var dbits = lines[i].strip().split(";");                                
                                        var timez = GMime.utils_header_decode_date(dbits[1], null);
                                        if (timez != 0) {
-                                               var dts = new DateTime.from_unix_utc(timez);
+                                               mailtime = new DateTime.from_unix_utc(timez);
                                                this.created_date = dts.format("%Y-%m-%d %H:%M:%S");
                                                // if it's not mailfort we can use that date to determine where to store it...
                                                if (!StripApplication.opt_scan_mailfort) {
-                                                       this.created_dir = dts.format("/%Y/%m/%d");
+                                                       this.created_dir = mailtime.format("/%Y/%m/%d");
                                                }
                                        }
                                }
 
                        }
                }
+               
+               var oldest = new  DateTime.now_local();
+               oldest.add_months(-1 * StripApplication.opt_min_age);
+               var tspan = mailtime.difference(oldest) / GLib.TimeSpan.MONTH;
+               GLib.log("File is %d months older than %d", tspan, StripApplication.opt_min_age);
+               
+               
+               
+               
                /*
                GLib.debug("Message DATA:\n mid: %s\nmailfort: %s \nexim_id: %s",
                        this.active_message_id,