From 8d1240017b0dd723c43f724d06a1c1f7703e7590 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 3 Apr 2015 23:30:26 +0100 Subject: [PATCH] Only add rules if they don't already exist --- src/freedombone-addemail | 12 +++++++----- src/freedombone-addlist | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/freedombone-addemail b/src/freedombone-addemail index 378f909a..fb343368 100755 --- a/src/freedombone-addemail +++ b/src/freedombone-addemail @@ -73,11 +73,13 @@ if [ ! -d "$LISTDIR" ]; then mkdir -m 700 $LISTDIR/cur fi chown -R $MYUSERNAME:$MYUSERNAME $LISTDIR -echo "" >> $PM -echo ":0" >> $PM -echo " * ^From: $EMAILADDRESS" >> $PM -echo "$LISTDIR/new" >> $PM -chown $MYUSERNAME:$MYUSERNAME $PM +if ! grep -q "From: $EMAILADDRESS" $PM; then + echo "" >> $PM + echo ":0" >> $PM + echo " * ^From: $EMAILADDRESS" >> $PM + echo "$LISTDIR/new" >> $PM + chown $MYUSERNAME:$MYUSERNAME $PM +fi if [ ! -f "$MUTTRC" ]; then cp /etc/Muttrc $MUTTRC chown $MYUSERNAME:$MYUSERNAME $MUTTRC diff --git a/src/freedombone-addlist b/src/freedombone-addlist index fef2b06f..be1faf75 100755 --- a/src/freedombone-addlist +++ b/src/freedombone-addlist @@ -79,7 +79,7 @@ if [ ! -d "$LISTDIR" ]; then fi chown -R $MYUSERNAME:$MYUSERNAME $LISTDIR -if ! grep -q "$LISTDIR/new" $PM; then +if ! grep -q "Subject:.*()\[$SUBJECTTAG\]" $PM; then echo "" >> $PM echo ":0" >> $PM echo " * ^Subject:.*()\[$SUBJECTTAG\]" >> $PM