summaryrefslogtreecommitdiff
path: root/bin/movemymail
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2022-07-04 10:05:09 -0700
committerSean Whitton <spwhitton@spwhitton.name>2022-07-11 18:37:32 -0700
commit2f8ce791b1f91193867ef90411da6fd88ff588be (patch)
tree6dfb2b7e6db87c9bd42d381c87eb370f2708107a /bin/movemymail
parent1bca0a557e970c88bacb582285b198365ddfb47b (diff)
downloaddotfiles-2f8ce791b1f91193867ef90411da6fd88ff588be.tar.gz
archive notmuch.el config to git history
Diffstat (limited to 'bin/movemymail')
-rwxr-xr-xbin/movemymail30
1 files changed, 1 insertions, 29 deletions
diff --git a/bin/movemymail b/bin/movemymail
index 39f30eb6..16ce96ab 100755
--- a/bin/movemymail
+++ b/bin/movemymail
@@ -14,25 +14,12 @@ open our $us, "<", $0 or die $!;
exit 0 unless flock $us, LOCK_EX|LOCK_NB;
our $root = "$ENV{HOME}/.fmail";
-our $on_athena = hostfqdn eq "athena.silentflame.com";
die "no movemymail\n" if -e "$ENV{HOME}/.nomovemymail";
open my $df, "-|", "df", "-kP", $root;
<$df>, my @df_fields = split " ", <$df>;
$df_fields[3] > 1048576 or die "free space low; no movemymail\n";
-# Sync notmuch's database to maildir and to git.
-if (-d "$root/.notmuch/xapian") {
- # Skip on athena because it's v. slow atm.
- system "mr", "-d", "$ENV{HOME}/lib/nmbug-spw", "autoci" unless $on_athena;
-
- # Ensure messages tagged in Emacs are in the appropriate folder. In the
- # case of spam, this should train FastMail's spam filter.
- search2folder("drafts", "tag:draft", "and", "not", "tag:deleted");
- search2folder("spam", "tag:spam");
- search2folder("trash", "tag:deleted");
-}
-
system [0, 1], "offline";
$? >> 8 == 0 and die "we're offline; cannot further sync mail\n";
@@ -48,7 +35,7 @@ if (my $exception = $@) {
# athena's 'notmuch new' cronjob is responsible for imap-dl(1) runs. We have
# this here rather than separate cronjob entries so that hitting 'G' in
# athena's Emacs inbox displays new mail from the other accounts.
-if ($on_athena) {
+if (hostfqdn eq "athena.silentflame.com") {
system "imap-dl", "$ENV{HOME}/.config/mailscripts/imap-dl.selene";
system "imap-dl", "$ENV{HOME}/.config/mailscripts/imap-dl.catmail";
}
@@ -64,18 +51,3 @@ for (<$root/*/new/*>) {
# Useful to see if any mail has got stuck before closing laptop lid.
`mailq` =~ "Mail queue is empty" or warn "WARNING: Outbox not empty.\n";
-
-sub search2folder {
- my ($folder, @terms) = @_;
- open my $search, "-|", "notmuch", "search", "--output=files", "--",
- "(", @terms, ")", "and", "not", "folder:$folder";
- my @matches;
- for (<$search>) {
- next if m{^\Q$root\E/annex/};
- chomp;
- # If notmuch's database is out-of-date the file may no longer exist
- # because it's already been moved by a previous run of this script.
- -f and push @matches, $_
- }
- @matches and system "mdmv", @matches, "$root/$folder";
-}