jaromail

a commandline tool to easily and privately handle your e-mail
git clone git://parazyd.org/jaromail.git
Log | Files | Refs | Submodules | README

commit 74f264866f3d1e4448e2a886ea378d4dcf8aa007
parent 7c058c945817db1874bfef6936e22f76b2079c53
Author: Jaromil <jaromil@dyne.org>
Date:   Sun, 22 Jul 2012 19:03:17 +0200

improved addressbook editing

Diffstat:
Msrc/zlibs/addressbook | 21++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/zlibs/addressbook b/src/zlibs/addressbook @@ -283,7 +283,10 @@ export_abook() { { test ! -r ${WORKDIR}/addressbook } && { create_addressbook } chmod 600 $WORKDIR/addressbook # make sure is private - act "Export addressbook into ABook $WORKDIR/addressbook.abook" + if [ -z ${PARAM[1]} ]; then list=whitelist + else list=${PARAM[1]}; fi + + act "Editing addressbook $list" tmp=$TMPDIR/abook.$datestamp.$RANDOM @@ -346,11 +349,18 @@ BEGIN { c=0; name=""; email=""; } ${=rm} $tmp # move addressbook to old - mv $WORKDIR/addressbook $WORKDIR/addressbook.old - func "Recreating the addressbook database" - create_addressbook + act "Updating the addressbook database" + cat <<EOF > $tmp +DROP TABLE $list; +CREATE TABLE $list +( + email text collate nocase, + name text collate nocase unique, + hits int +); + +EOF - touch $tmp newa=1; _name=""; _email="" for a in ${(f)addresses}; do @@ -367,6 +377,7 @@ BEGIN { c=0; name=""; email=""; } func "Inserting the updated addressbook" cat $tmp | ${SQL} -batch $WORKDIR/addressbook 2> /dev/null ${=rm} $tmp + notice "Addressbook updated" } ###################