summaryrefslogtreecommitdiff
path: root/bayes
diff options
context:
space:
mode:
Diffstat (limited to 'bayes')
-rw-r--r--bayes15
1 files changed, 15 insertions, 0 deletions
diff --git a/bayes b/bayes
index 0843976..e3814fc 100644
--- a/bayes
+++ b/bayes
@@ -3,6 +3,7 @@ use v6.d.PREVIEW;
use lib 'lib';
use MaildirIndexer::ScanDir;
use MaildirIndexer::Store;
+use MaildirIndexer::Parser;
sub MAIN($maildir) {
my $store = MaildirIndexer::Store.new;
@@ -23,10 +24,24 @@ sub MAIN($maildir) {
}
}
+ my $listener = IO::Socket::Async.listen(
+ '127.0.0.1',
+ 9000,
+ :enc<utf8-c8>,
+ );
+
react {
whenever signal(SIGINT) { exit }
whenever signal(SIGHUP) {
$store.dump();
}
+ whenever $listener -> $conn {
+ LEAVE { $conn.close }
+ with parse-email($conn) -> $email {
+ with $store.mailbox-for-email($email) -> $mailbox {
+ await $conn.print("$mailbox\x0d\x0a");
+ }
+ }
+ }
}
}