From: Jaakko Heinonen Date: Tue, 8 Oct 2002 15:53:17 +0000 (+0000) Subject: added option add_email_prevent_duplicates X-Git-Tag: upstream/0.6.1~2^2~272 X-Git-Url: https://git.deb.at/?a=commitdiff_plain;h=5e635a27701c8565f78feed6a9dce51b09662bde;p=pkg%2Fabook.git added option add_email_prevent_duplicates --- diff --git a/abook.c b/abook.c index 7bc654d..d4de3ec 100644 --- a/abook.c +++ b/abook.c @@ -723,6 +723,16 @@ add_email_add_item(int quiet, char *name, char *email) { list_item item; + if(opt_get_bool(BOOL_ADD_EMAIL_PREVENT_DUPLICATES)) { + int search_fields[] = { EMAIL, -1 }; + if(find_item(email, 0, search_fields) >= 0) { + if(!quiet) + printf("Address %s already in addressbook\n", + email); + return 0; + } + } + if(!quiet) { FILE *in = fopen("/dev/tty", "r"); char c; diff --git a/options.c b/options.c index fa05313..3947a38 100644 --- a/options.c +++ b/options.c @@ -64,6 +64,8 @@ static struct option abook_vars[] = { { "use_ascii_only", OT_BOOL, BOOL_USE_ASCII_ONLY, FALSE }, + { "add_email_prevent_duplicates", OT_BOOL, BOOL_ADD_EMAIL_PREVENT_DUPLICATES, FALSE }, + { NULL } }; diff --git a/options.h b/options.h index 13e9709..a22a6a6 100644 --- a/options.h +++ b/options.h @@ -17,6 +17,7 @@ enum bool_opts { BOOL_SHOW_ALL_EMAILS, BOOL_MUTT_RETURN_ALL_EMAILS, BOOL_USE_ASCII_ONLY, + BOOL_ADD_EMAIL_PREVENT_DUPLICATES, BOOL_MAX }; diff --git a/sample.abookrc b/sample.abookrc index 9809767..a5359df 100644 --- a/sample.abookrc +++ b/sample.abookrc @@ -47,3 +47,4 @@ set address_style=eu # use ASCII characters only set use_ascii_only=false +set add_email_prevent_duplicates=false