commit 6a6e75987f0862386118c0ed49681e16d0476590
parent 74f264866f3d1e4448e2a886ea378d4dcf8aa007
Author: Jaromil <jaromil@dyne.org>
Date: Mon, 23 Jul 2012 10:21:53 +0200
addressbook name filtering optimizations
Diffstat:
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/zlibs/addressbook b/src/zlibs/addressbook
@@ -134,7 +134,8 @@ learn() {
chmod 600 $WORKDIR/addressbook # make sure is private
tmp=$TMPDIR/learn.$datestamp.$RANDOM
- from="`tee -i $tmp | formail -xFrom: | sed -e 's/\"//g'`"
+ from="`tee -i $tmp | formail -xFrom: | sed -e 's/\"//g;s/<.*>//;s/^[ \t]*//;s/[ \t]*$//'`"
+
if [ -z ${PARAM[1]} ]; then
email="`cat $tmp | ${WORKDIR}/bin/fetchaddr| awk '{print $1}'`"
else
@@ -265,7 +266,7 @@ EOF
_email=`echo $a | cut -d'|' -f1`
# remove from name all what is an email between brackets
# crop (trim) all beginning and ending whitespaces from name
- _name=`echo $a | cut -d'|' -f2 | sed 's/<.*>//' | sed 's/^[ \t]*//;s/[ \t]*$//'`
+ _name=`echo $a | cut -d'|' -f2 | sed 's/<.*>//;s/^[ \t]*//;s/[ \t]*$//'`
{ test "${_email}" != "" } && {
cat <<EOF >> $WORKDIR/addressbook.vcf
BEGIN:VCARD
@@ -315,7 +316,7 @@ EOF
_email=`echo $a | cut -d'|' -f1`
# remove from name all what is an email between brackets
# crop (trim) all beginning and ending whitespaces from name
- _name=`echo $a | cut -d'|' -f2 | sed 's/<.*>//' | sed 's/^[ \t]*//;s/[ \t]*$//'`
+ _name=`echo $a | cut -d'|' -f2 | sed 's/<.*>//;s/^[ \t]*//;s/[ \t]*$//'`
{ test "${_email}" != "" } && {
cat <<EOF >> $WORKDIR/addressbook.abook
[${c}]