blob: b0bb8ae7f0c85768c47b0e80b8fb2af7a831d985 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
#!/usr/bin/env bash
#!/usr/bin/env nix-shell
#!nix-shell --pure -i bash -p bash
# shellcheck shell=bash
set -Eeuo pipefail
MAILING_LIST_NAME="${1:-}"
GNU_MBOX_ARCHIVE_URL='ftp://lists.gnu.org'
OUT_MAILDIR="$HOME/mbsync/EuAndreh/mailing-lists/"
TMP_DIR="$HOME/tmp/mbox-import/"
usage() {
cat <<EOF
Usage:
$0 MAILING_LIST_NAME
Arguments
MAILING_LIST_NAME The name of the mailing list.
Examples:
Download and import into mbsync the MBOX archive from info-guix mailing-list:
echo 1 | mailing-list-import-mbox.sh info-guix
Download and import into mbsync the contents for lisp-br Google Groups:
echo 2 | mailing-list-import-mbox.sh lisp-br
EOF
}
set -x
gnu_mailing_list_import() {
mkdir -p "${TMP_DIR}"
pushd "${TMP_DIR}"
wget -c -r "${GNU_MBOX_ARCHIVE_URL}/${MAILING_LIST_NAME}/"
cat "lists.gnu.org/${MAILING_LIST_NAME}/"* > "${MAILING_LIST_NAME}.all.mbox"
mb2md -s "${TMP_DIR}/${MAILING_LIST_NAME}.all.mbox" -d "${OUT_MAILDIR}"
popd
}
google_groups_import() {
echo "google groups ${MAILING_LIST_NAME}"
}
main() {
[[ -z "${MAILING_LIST_NAME}" ]] && {
red "Missing input argument MAILING_LIST_NAME.\n"
usage
exit 2
}
echo "(1) - GNU mailing lists (lists.gnu.org)"
echo "(2) - Google Groups"
read -p "Which type of mailing list do you want to import? " -n 1 -r
echo # Move to a new line
case "$REPLY" in
"1")
gnu_mailing_list_import
;;
"2")
google_groups_import
;;
*)
red "Unsupported mailing list type."
red "Exitting."
usage
exit 2
;;
esac
}
main "$@"
# notmuch search --output=files tag:spam \
# and not folder:${PREFIX}junk \
# and not folder:${PREFIX}greyspam \
# and not folder:Koumbit/INBOX \
# and not path:Koumbit/** \
# | while read file; do
# mv "$file" "$HOME/Maildir/${PREFIX}junk/cur"
# done
# notmuch search --output=files --exclude=false tag:deleted | xargs -I{} rm "{}"
# https://julien.danjou.info/why-notmuch-is-not-much-good/
# https://www.reddit.com/r/emacs/comments/6z13yw/notmuch_vs_imap_and_sieve/
# https://anarc.at/blog/2016-05-12-email-setup/
# https://duckduckgo.com/?q=notmuch+sieve&t=ffab&atb=v166-1&ia=web
|