summaryrefslogtreecommitdiff
path: root/bayes
diff options
context:
space:
mode:
Diffstat (limited to 'bayes')
-rw-r--r--bayes18
1 files changed, 14 insertions, 4 deletions
diff --git a/bayes b/bayes
index c7c81bf..0843976 100644
--- a/bayes
+++ b/bayes
@@ -2,21 +2,31 @@
use v6.d.PREVIEW;
use lib 'lib';
use MaildirIndexer::ScanDir;
-use MaildirIndexer::Parser;
+use MaildirIndexer::Store;
sub MAIN($maildir) {
+ my $store = MaildirIndexer::Store.new;
+
my $file-supply = scan-dir($maildir);
my $file-channel = $file-supply.Channel;
+
for ^10 {
start react {
whenever $file-channel -> $file {
if $file.e && $file.f {
- my $email = parse-email($file,:headers-only);
- say "{$file} - {$email<headers><Subject>}";
+ $store.add-file($file);
+ }
+ elsif !$file.e {
+ $store.del-file($file);
}
}
}
}
- react whenever signal(SIGINT) { exit }
+ react {
+ whenever signal(SIGINT) { exit }
+ whenever signal(SIGHUP) {
+ $store.dump();
+ }
+ }
}