shellcheck, remove old files
[distro-setup] / disabled / offlineimap-sync
diff --git a/disabled/offlineimap-sync b/disabled/offlineimap-sync
deleted file mode 100755 (executable)
index 059f546..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/bin/bash
-# I, Ian Kelling, follow the GNU license recommendations at
-# https://www.gnu.org/licenses/license-recommendations.en.html. They
-# recommend that small programs, < 300 lines, be licensed under the
-# Apache License 2.0. This file contains or is part of one or more small
-# programs. If a small program grows beyond 300 lines, I plan to switch
-# its license to GPL.
-
-# Copyright 2024 Ian Kelling
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-set -eE -o pipefail
-trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
-# mail-route can get messed up a bit randomly, I don't know why.
-#/b/ds/mail-route up |& /b/log-quiet/log-once -1 mail-route
-
-for f in $(awk '$1 == "localfolders" {print $NF}' ~/.offlineimaprc); do
-  mkdir -p $f
-  chmod 700 $f
-done
-
-offlineimap -u quiet
-shopt -s nullglob
-
-if grep -qP '^ *accounts.*fsf' ~/.offlineimaprc; then
-  if [[ ! -e /nocow/user/.mufsf ]]; then
-    mkdir -p /nocow/user/.mufsf
-    chmod 700 /nocow/user/.mufsf
-    mu index --maildir=/nocow/user/fsfmd
-  fi
-fi
-
-omv() { # offlineimap mv. move mail files within $src_base/$1 to /m/md/$2
-  src="$1"
-  dst="$2"
-  found_files=false
-  for x in new cur; do
-    files=($src_base/"$src"/$x/*)
-    if [[ $files ]]; then
-      found_files=true
-      mv "${files[@]}" /m/md/"$dst"/$x
-    fi
-  done
-}
-
-src_base=/m/offlineimap
-omv "Sent Items" "Sent"
-omv INBOX offlineimaptmp
-src_base=/m/md
-if $found_files; then
-  sieve-filter -eW ~/sieve/main.sieve offlineimaptmp &>/dev/null
-  # the default folder is INBOX for anything leftover
-  omv offlineimaptmp INBOX
-  # remove messages from remote host
-  offlineimap -u quiet
-  # this makes us sit and wait when we want to use mu and this is running in a cronjob.
-  # todo: emacs updates the index much faster. what command is it running? I'd like
-  # to just run that
-  # looks like it might be mu index --lazy-check, but that still takes like 10 seconds,
-  # figure out if that is the same speed, or if we can make it faster.
-  #mu index &>/dev/null ||:
-fi
-
-
-# delete based on http://deflexion.com/2006/05/imap-way-of-deleting-message
-sieve-filter -eW -o mail_location=maildir:/nocow/user/fsfmd:LAYOUT=fs:INBOX=/nocow/user/fsfmd/INBOX ~/sieve/fsf.sieve INBOX delete &>>/tmp/fsfsieve.log
-
-# to test new rules, update fsf-test.sieve, run these commands, then copy new fsf-test.sieve to fsf.sieve
-# sieve-filter -o mail_location=maildir:/nocow/user/fsfmd:LAYOUT=fs:INBOX=/nocow/user/fsfmd/INBOX ~/sieve/fsf-test.sieve INBOX &>/tmp/testfsfsieve.log
-# sed -rn '/^Performed actions:/{n;n;p}' /tmp/testfsfsieve.log | sort -u