aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2022-11-24 18:38:27 -0300
committerEuAndreh <eu@euandre.org>2022-11-24 18:38:27 -0300
commit66e057a4ed2d1f33c5e02cc8f6f2cc36137ba53d (patch)
tree28ffeb60a996bf313c830d79b44d62d03d7de472 /bin
parentetc/guix/home.scm: Use patched "mailutils-sendmail" package (diff)
downloaddotfiles-66e057a4ed2d1f33c5e02cc8f6f2cc36137ba53d.tar.gz
dotfiles-66e057a4ed2d1f33c5e02cc8f6f2cc36137ba53d.tar.xz
Revert "Revert "Move email, IRC and Atom into Thunderbird""
This reverts commit 3dcbe37baab74e089dee6f93d74a8824f5591478. The Postfix local server is still a bit janky and being worked on, now can be used to replace the previous email toolchain.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/m66
-rwxr-xr-xbin/mailcfg297
2 files changed, 0 insertions, 363 deletions
diff --git a/bin/m b/bin/m
deleted file mode 100755
index 6891128..0000000
--- a/bin/m
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/bin/sh
-set -eu
-
-usage() {
- cat <<-'EOF'
- Usage:
- m
- m -h
- EOF
-}
-
-help() {
- cat <<-'EOF'
-
- Options:
- -h, --help show this message
-
-
- Fetch email via IMAP and update the notmuch index.
-
-
- Examples:
-
- Just fetch email
-
- $ m
- EOF
-}
-
-
-for flag in "$@"; do
- case "$flag" in
- --)
- break
- ;;
- --help)
- usage
- help
- exit
- ;;
- *)
- ;;
- esac
-done
-
-while getopts 'h' flag; do
- case "$flag" in
- h)
- usage
- help
- exit
- ;;
- *)
- usage >&2
- exit 2
- ;;
- esac
-done
-shift $((OPTIND - 1))
-
-
-F="${XDG_DATA_HOME:-$HOME/.local/share}"/euandreh/mailcfg-accounts.txt
-
-notmuch new
-xargs -I% -P "$(wc -l < "$F")" mbsync '%' < "$F"
-notmuch new
diff --git a/bin/mailcfg b/bin/mailcfg
deleted file mode 100755
index f77355e..0000000
--- a/bin/mailcfg
+++ /dev/null
@@ -1,297 +0,0 @@
-#!/bin/sh
-# shellcheck disable=1090,2153
-set -eu
-
-usage() {
- cat <<-'EOF'
- Usage:
- mailcfg ACTION
- mailcfg -h
- EOF
-}
-
-help() {
- cat <<-'EOF'
-
- Options:
- -h, --help show this message
-
- ACTION one of:
- - mbsync
- - msmtp
- - notmuchcfg
- - notmuchhook
- - alot
- - list
-
-
- Emit the generated configuration file for the chosen email
- program. Get the configuration files from
- $XDG_CONFIG_HOME/mailcfg/*.env, where every *.env file is a
- shell script that defines the variables used in this program:
- - $NAME
- - $LABEL
- - $IMAP
- - $SMTP
- - $ADDR
-
- One of the files also needs to define:
- - $DEFAULT_NAME
- - $DEFAULT_ADDR
- - $DEFAULT_LABEL
-
- An example of such file could be "30-andre@work.com.env":
-
- #!/bin/sh
- set -eu
-
-
- NAME='André!'
- LABEL='Work'
- IMAP='imap.work.com'
- SMTP='smtp.work.com'
- ADDR='andre@work.com'
-
-
- Examples:
-
- Get the alot configuration file:
-
- $ mailcfg alot
-
-
- List the existing account labels:
-
- $ mailcfg list
- EOF
-}
-
-
-for flag; do
- case "$flag" in
- --)
- break
- ;;
- --help)
- usage
- help
- exit
- ;;
- *)
- ;;
- esac
-done
-
-while getopts 'h' flag; do
- case "$flag" in
- h)
- usage
- help
- exit
- ;;
- *)
- usage >&2
- exit 2
- ;;
- esac
-done
-shift $((OPTIND - 1))
-
-ACTION="${1:-}"
-eval "$(assert-arg "$ACTION" 'ACTION')"
-
-CFGDIR="${XDG_CONFIG_HOME:-$HOME/.config}/mailcfg"
-
-
-mbsync() {
- cat <<-'EOF'
- SyncState *
- Create Both
- Expunge Both
- Remove Both
- Sync All
- EOF
-
- for env in "$CFGDIR"/*.env; do
- . "$env"
- cat <<-EOF
-
-
- ## $LABEL
-
- IMAPAccount $LABEL
- Host $IMAP
- User $ADDR
- PassCmd "pass show $ADDR"
- SSLType IMAPS
-
- IMAPStore ${LABEL}Remote
- Account $LABEL
-
- MaildirStore ${LABEL}Local
- Path ~/Maildir/$LABEL/
- Inbox ~/Maildir/$LABEL/INBOX
- SubFolders Verbatim
-
- Channel ${LABEL}Folders
- Far :${LABEL}Remote:
- Near :${LABEL}Local:
- Patterns *
-
- Group $LABEL
- Channel ${LABEL}Folders
- EOF
- done
-}
-
-msmtp() {
- cat <<-EOF
- defaults
- auth on
- tls on
- port 587
- syslog on
- logfile $XDG_LOG_HOME/msmtp.log
- EOF
-
- for env in "$CFGDIR"/*.env; do
- . "$env"
- cat <<-EOF
-
- account $LABEL
- host $SMTP
- from $ADDR
- user $ADDR
- passwordeval pass show $ADDR
- EOF
- done
-
- cat <<-EOF
-
- account default : $DEFAULT_LABEL
- EOF
-}
-
-notmuchcfg() {
- for env in "$CFGDIR"/*.env; do
- . "$env"
- done
-
- cat <<-EOF
- [user]
- name = $DEFAULT_NAME
- primary_email = $DEFAULT_ADDR
- EOF
-
- printf 'other_email = '
- for env in "$CFGDIR"/*.env; do
- . "$env"
- if [ "$ADDR" = "$DEFAULT_ADDR" ]; then
- continue
- fi
- echo "$ADDR"
- done | paste -sd';'
-
- cat <<-'EOF'
-
- [new]
- tags = new;
- ignore = .mbsyncstate;.uidvalidity
-
- [search]
- exclude_tags = deleted;spam
-
- [maildir]
- synchronize_flags = true
- EOF
-}
-
-notmuchhook() {
- LABELS=''
- for env in "$CFGDIR"/*.env; do
- . "$env"
- if [ -z "$LABELS" ]; then
- LABELS="$LABEL"
- else
- LABELS="$LABELS $LABEL"
- fi
- done
- sed \
- -e "s|@DIRS@|$LABELS|g" \
- -e "s|@DEFAULT_LABEL@|$DEFAULT_LABEL|g" \
- "$CFGDIR"/post-new
-}
-
-alot() {
- cat <<-'EOF'
- attachment_prefix = "~/Downloads/"
-
- [bindings]
- i = toggletags inbox
- I = search folder:/INBOX/ AND NOT tag:killed AND NOT tag:archive
- EOF
- echo "
- z archive
- s spam
- u unread
- r keep
- t track
- " | while read -r l; do
- if [ -z "$l" ]; then
- continue
- fi
- LC="$( echo "$l" | cut -d' ' -f1)"
- TAG="$(echo "$l" | cut -d' ' -f2)"
- UC="$(echo "$LC" | tr '[:lower:]' '[:upper:]')"
- cat <<-EOF
- $LC = toggletags $TAG
- $UC = search tag:$TAG AND NOT tag:killed
- EOF
- done
-
- cat <<-'EOF'
- M = search folder:/lists/ AND NOT tag:killed
- m = compose --tags inbox
- [[thread]]
- v = pipeto urlscan 2>/dev/null
- V = pipeto 'gpg -d | less'
- r = reply --all
- R = reply
- ' ' = fold; untag unread; move next unfolded
- P = pipeto 'git am'
-
- [accounts]
- EOF
-
- for env in "$CFGDIR"/*.env; do
- . "$env"
- cat <<-EOF
- [[$LABEL]]
- realname = $NAME
- address = $ADDR
- sendmail_command = msmtpq --account=$LABEL -t
- sent_box = maildir://~/Maildir/$LABEL/Sent
- draft_box = maildir://~/Maildir/$LABEL/Drafts
- gpg_key = 5BDAE9B8B2F6C6BCBB0D6CE581F90EC3CD356060
- EOF
- done
-}
-
-list() {
- for env in "$CFGDIR"/*.env; do
- . "$env"
- printf '%s\n' "$LABEL"
- done
-}
-
-
-case "$ACTION" in
- mbsync|msmtp|notmuchcfg|notmuchhook|alot|list)
- "$1"
- ;;
- *)
- printf 'Unsupported ACTION: "%s".\n\n' "$ACTION" >&2
- usage >&2
- exit 2
- ;;
-esac