summaryrefslogtreecommitdiffstats
path: root/script
diff options
context:
space:
mode:
Diffstat (limited to 'script')
-rwxr-xr-xscript/imap-notify.pl58
1 files changed, 58 insertions, 0 deletions
diff --git a/script/imap-notify.pl b/script/imap-notify.pl
new file mode 100755
index 0000000..f2f7c2c
--- /dev/null
+++ b/script/imap-notify.pl
@@ -0,0 +1,58 @@
+#!/usr/bin/env perl
+
+=head1 DESCRIPTION
+
+Simple notification script using IMAP NOTIFY. Note that it is very simple and
+implements a custom IMAP client with very limited features. Mostly a proof of
+concept and personal script.
+
+=cut
+
+use v5.24;
+
+use warnings;
+use strict;
+
+use App::ImapNotify;
+use Function::Parameters;
+use MCE::Hobo;
+use Log::Any::Adapter ('Stderr', log_level => "warn");
+
+my $config = [
+ {
+ log_id => "server-speed",
+ host => 'mail.server-speed.net',
+ port => 993,
+ username => 'mail-flo',
+ password => trim(`getpw-single msmtp3`),
+ mailboxes => [qw(INBOX INBOX.Postmaster INBOX.TISS INBOX.tuwel)],
+ },
+ #{
+ #log_id => "luxx",
+ #host => 'mail.nano-srv.net',
+ #port => 993,
+ #username => 'bluewind@luxx-area.de',
+ #password => trim(`getpw-single bluewind\@luxx-area.de`),
+ #mailboxes => [qw(INBOX)],
+ #},
+];
+
+#$IO::Socket::SSL::DEBUG = 4;
+
+my @workers;
+
+for my $single_conf ($config->@*) {
+ push @workers, mce_async {
+ my $app = App::ImapNotify->new($single_conf);
+ $app->loop();
+ }
+}
+
+map {$_->join()} @workers;
+
+fun trim($string) {
+ $string =~ s/^\s+//;
+ $string =~ s/\s+$//;
+ return $string;
+}
+