blob: 89e13c7a92411283b9363496a306b22e3953bf98 (
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
|
#!/bin/bash
CONFIG=$(dirname $0)/maillists
RESULT=maillists.generate
FOLDER_HOOK=folder-hooks.maillist
die() {
echo $1
exit 1
}
add_maillist() {
email=$1
mailbox=$2
echo "# email: $email"
echo "# mailbox: $mailbox"
# Subscription
echo "subscribe $email"
# Mailboxes
echo "mailboxes \"$mailbox\""
# Folder hook
echo "folder-hook \"$mailbox\" source $FOLDER_HOOK"
# FCC hook
echo "fcc-hook $email \"$mailbox\""
printf "\n\n"
}
test -f "$CONFIG" || die "Config file ($RESULT) not exists."
echo "# Generate date: $(date)" > "$RESULT" || die "Can't write file ($RESULT)."
echo "# vim: ft=muttrc :" >> "$RESULT"
while read email mailbox
do
if [[ -n "$email" ]]
then
if [[ "$(echo $email | sed 's/^\s*#//')" == "$email" ]]
then
add_maillist $email $mailbox >> "$RESULT"
fi
fi
done < "${CONFIG}"
|