summaryrefslogtreecommitdiffstats
path: root/.local/bin
diff options
context:
space:
mode:
authorjoe <rbo@gmx.us>2025-10-01 19:26:39 +0200
committerjoe <rbo@gmx.us>2025-10-01 19:26:39 +0200
commitb2cf5b2b1234edc309405397a8c652204fa61489 (patch)
treea3dd744ab166634b119d3ce4ed022a9f73cd745f /.local/bin
parentup (diff)
downloaddotfiles-bsd-b2cf5b2b1234edc309405397a8c652204fa61489.tar.gz
dotfiles-bsd-b2cf5b2b1234edc309405397a8c652204fa61489.tar.bz2
dotfiles-bsd-b2cf5b2b1234edc309405397a8c652204fa61489.tar.xz
dotfiles-bsd-b2cf5b2b1234edc309405397a8c652204fa61489.tar.zst
dotfiles-bsd-b2cf5b2b1234edc309405397a8c652204fa61489.zip
up
Diffstat (limited to '')
-rwxr-xr-x.local/bin/fetch_mail46
1 files changed, 46 insertions, 0 deletions
diff --git a/.local/bin/fetch_mail b/.local/bin/fetch_mail
new file mode 100755
index 0000000..0d35cf5
--- /dev/null
+++ b/.local/bin/fetch_mail
@@ -0,0 +1,46 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+use Env qw(HOME);
+
+use constant MC_FILE_PATH => '/tmp/mc_';
+
+sub get_all_accs
+{
+ opendir(my $dh, $ENV{'MAIL'});
+ return;
+}
+
+sub count_new_mails
+{
+ my ($acc, $maildir) = @_;
+ my $count;
+ my $dir;
+ my $path = $maildir . $acc . '/INBOX/new';
+
+ $count = 0;
+ opendir(my $dh, $path) or die $!;
+ $count = grep { -f "$path/$_"} readdir($dh);
+ closedir($dh);
+ return $count;
+}
+
+sub fetch_mail
+{
+ $ENV{'MAIL'} = $HOME . '/.local/share/mail';
+ $ENV{'GNUPGHOME'} = $HOME . '/.local/share/gnupg';
+ $ENV{'PASSWORD_STORE_DIR'} = $HOME . '/.local/share/pass';
+ my $maildir = $ENV{'MAIL'} . '/';
+ # my @accs = (ACCOUNTS);
+
+ get_all_accs();
+ # my $mc_file = MC_FILE_PATH . $accs[0];
+ # my $pre_count = count_new_mails($accs[0], $maildir);
+ # print $pre_count . "\n";
+ return;
+}
+
+fetch_mail();
+
+__END__