src/strip.vala
[app.mailtrimmer] / src / strip.vala
index 98dbee5..fbe4246 100644 (file)
@@ -3,7 +3,7 @@
  ** check left to do:  
   - range scans on maildir
   - see how replacing the links works in the resulting email via thunderbird etc..
-  
+  - some checksum issues (see dupelicates?? suspect 0byte issues?)  -- seems ok now?
  
 
 
@@ -760,8 +760,8 @@ public class Strip : GLib.Object {
                
                var oldest = new  DateTime.now_local();
                oldest = oldest.add_months(-1 * StripApplication.opt_age_oldest);
-               var rtspan = oldest.difference(oldest) / GLib.TimeSpan.DAY;
-
+               var rtspan = mailtime.difference(oldest) / GLib.TimeSpan.DAY;
+               GLib.debug("Checking oldest %d days difference", (int)rtspan   );
                if (rtspan < 0) {
                        GLib.debug("skip(2) file is %d days older than %d months", (int)rtspan, StripApplication.opt_age_oldest);
                        return;
@@ -851,11 +851,12 @@ public class Strip : GLib.Object {
                Posix.unlink(path +"/" + name);         
                GLib.debug("copy tmp file %s to %s" , tmpfile, path +"/" + name);               
                Posix.link(tmpfile, path +"/" + name);
-               Posix.unlink(tmpfile);
+
                var nf = File.new_for_path(path +"/" + name);
                var newfileinfo = nf.query_info(GLib.FileAttribute.TIME_MODIFIED,GLib.FileQueryInfoFlags.NONE,null);
                newfileinfo.set_modification_time(mod_time);
                nf.set_attributes_from_info(newfileinfo,FileQueryInfoFlags.NONE);
+               Posix.unlink(tmpfile);
                }
        this.processed++;