commit fbe9ff23cb70d29655d5dee406af2bd1c9575b7f
parent 53822257c95add3dee9270aa6aae411d68a90940
Author: Jaromil <jaromil@dyne.org>
Date: Mon, 14 May 2012 22:54:52 +0200
fixed identity update switch
Diffstat:
2 files changed, 45 insertions(+), 11 deletions(-)
diff --git a/install.sh b/install.sh
@@ -53,15 +53,11 @@ ${=mkdir} $WORKDIR/tmp $WORKDIR/cache
if ! [ -r $WORKDIR/Filters.txt ]; then
cat <<EOF > $WORKDIR/Filters.txt
-# Example filter configuration for Jaromail
+# Example filter configuration for Jaro Mail
-# accepted email addresses
-to jaromil@dyne.org save priv
-to jaromil@kyuzz.org save priv
-to jaromil@enemy.org save priv
-to jaromil@montevideo.nl save priv
+# mailinglist filters are in order of importance
+# syntax: to <list email> save <folder>
-# mailinglist filters, in order of importance
to crypto@lists.dyne save dyne.crypto
to dynebolic save dyne.dynebolic
to freej save dyne.freej
@@ -75,6 +71,9 @@ to debian-blends save debian.blends
to freedombox-discuss save debian.freedombox
# other filters for web 2.0 services
+# using folder names with a prefix. can facilitate
+# folder maintainance.
+
from identi.ca save web.identica
from Twitter save web.twitter
from linkedin save web.linkedin
@@ -213,10 +212,10 @@ case $OS in
cp -a build/osx/* $WORKDIR/bin
fi
touch $HOME/.profile
- cat $HOME/.profile | grep '^# Jaromail' > /dev/null
+ cat $HOME/.profile | grep '^# Jaro Mail' > /dev/null
if [ $? != 0 ]; then
cat <<EOF >> $HOME/.profile
-# Jaromail Installer addition on `date`
+# Jaro Mail Installer addition on `date`
export PATH=$WORKDIR/bin:\$PATH
# Finished adapting your PATH
EOF
diff --git a/src/jaro b/src/jaro
@@ -280,6 +280,37 @@ read_account() {
esac
return 0
}
+# read a default account
+# arg: "in" or "out"
+# meaning an account to receive or send emails
+read_default_account() {
+ adir=$WORKDIR/Accounts
+ typeset -al all
+ if [ -z $1 ]; then
+ error "Error: read_default_account called without argument"
+ return 1
+ fi
+ case $1 in
+ "in")
+ if [ -r $adir/imap.default ]; then
+ read_account imap.default
+ else
+ for a in `find $adir -name "imap*"`; do all+=($a); done
+ for a in `find $adir -name "pop*"`; do all+=($a); done
+ read_account `basename ${all[1]}` # take the first found
+ fi
+ ;;
+ "out")
+ if [ -r $adir/smtp.default ]; then
+ read_account smtp.default
+ else
+ for a in `find $adir -name "smtp*"`; do all+=($a); done
+ read_account `basename ${all[1]}` # take the first found
+ fi
+ ;;
+ esac
+ return 0
+}
queue() {
local base;
@@ -523,10 +554,14 @@ source $MUTTDIR/identity
EOF
- # just the header, will be completed later in procmail loop
+ # just the header, will be completed later in procmail loop
rm -f $MUTTDIR/mboxes
echo -n "mailboxes +priv" > $MUTTDIR/mboxes
-
+
+ # update identity with default
+ read_default_account "in"
+ switch_identity
+
##########
# PROCMAIL
${=mkdir} $PROCMAILDIR