summaryrefslogtreecommitdiff
path: root/bayes
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2018-11-09 15:19:16 +0000
committerdakkar <dakkar@thenautilus.net>2018-11-09 15:19:16 +0000
commit3b97aa0df99bcad2656899c03ee1f759cb3efc55 (patch)
tree96fbf7a5d09dfa58b1e0d2341ed2585792035a33 /bayes
parentignore precompiled directory (diff)
downloadMaildirIndexer-3b97aa0df99bcad2656899c03ee1f759cb3efc55.tar.gz
MaildirIndexer-3b97aa0df99bcad2656899c03ee1f759cb3efc55.tar.bz2
MaildirIndexer-3b97aa0df99bcad2656899c03ee1f759cb3efc55.zip
in-memory store, and Email class
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();
+ }
+ }
}