public static string? opt_db_name = null;
public static string? opt_db_user = null;
public static string? opt_db_pass = null;
-
+ public static string? opt_scan_mailfort_only = "";
+
+
public static int opt_limit = -1;
public static int opt_age_newest = 1;
public static bool opt_scan_mailfort = false;
public static bool opt_dump = false;
public static bool opt_debug = false;
+ public static bool opt_stamp = false;
public static bool opt_debug_sql = false;
public static string? opt_replace_link = null;
{ "oldest", 0, 0, OptionArg.INT, ref opt_age_oldest, "do not replace messages older than X (default is 6 months)", null },
{ "scan-maildir", 0, 0, OptionArg.NONE, ref opt_scan_maildir, "scan an maildir tree", null },
- { "scan-mailfort", 0, 0, OptionArg.NONE, ref opt_scan_mailfort, "scan a mailfort tree", null },
+ { "stamp", 0, 0, OptionArg.NONE, ref opt_stamp, "create and honour directory stamps - flag that a folder has been scanned already", null },
+ { "scan-mailfort", 0, 0, OptionArg.NONE, ref opt_scan_mailfort, "scan a mailfort tree", null },
+ { "scan-mailfort-only", 0, 0, OptionArg.STRING, ref opt_scan_mailfort_only, "scan a mailfort Year/month eg. /2010/08", null },
{ null }
};
public StripApplication( string[] args )
return 0;
}
- strip.scan_dir(opt_path, "");
+ strip.scan_dir(opt_path, opt_scan_mailfort_only);
int.parse(sid)));
- if (matches == "") {
+ if (matches == "0") {
// our old mailfort code deleted the crap out of old records...
// if this occurs we will need to create the record again..
this.fix_deleted_attachment_db(int.parse(sid),attachment);
var filename = attachment.get_header("X-strip-content-name");
var file_path = attachment.get_header("X-strip-path");
var fn = StripApplication.opt_target_path + "/" + file_path;
+
+
+ if (!FileUtils.test (fn, FileTest.EXISTS)) {
+ GLib.debug("SKIP -- file does not exist");
+ return;
+ }
+
var chksum = this.md5_file(fn);
var mime_type = attachment.get_header("X-strip-content-type");
,GLib.FileQueryInfoFlags.NONE,null);
var file_size = (int) fileinfo.get_size();
- if (!FileUtils.test (fn, FileTest.EXISTS)) {
- GLib.debug("SKIP -- file does not exist");
- }
this.real_query(-1, """
"/"+ this.active_name + "."+ GLib.Uri.escape_string(filename,"", false);
var outfile = new GMime.StreamFile.for_path(fn, "w");
+ if (outfile == null) {
+ return; // something has gone wrong??
+ }
outfile.set_owner(true);
var file_size = (int) c.write_to_stream(outfile);
var chksum = this.md5_file(fn);
}
+ if (StripApplication.opt_stamp && GLib.FileUtils.test( basepath + subpath + "/.strip-done-stamp", GLib.FileTest.EXISTS )) {
+ return;
+ }
+
var f = File.new_for_path(basepath + subpath);
FileEnumerator file_enum;
this.scan_dir(basepath,sp);
}
+
+ // completed this folder
+
+ if (StripApplication.opt_stamp) {
+ GLib.FileUtils.set_contents (basepath + subpath + "/.strip-done-stamp", "Stripper done");
+ }
+
}