]> git.deb.at Git - pkg/abook.git/commitdiff
added option add_email_prevent_duplicates
authorJaakko Heinonen <jheinonen@users.sourceforge.net>
Tue, 8 Oct 2002 15:53:17 +0000 (15:53 +0000)
committerJaakko Heinonen <jheinonen@users.sourceforge.net>
Tue, 8 Oct 2002 15:53:17 +0000 (15:53 +0000)
abook.c
options.c
options.h
sample.abookrc

diff --git a/abook.c b/abook.c
index 7bc654dc35271e72d21f1a080b88f6e3fceaf453..d4de3ec5679d71620fa311c790998618ec03072e 100644 (file)
--- 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;
index fa0531352973a04d35e8f72686002d0922403ef5..3947a38a959855a5621c4673c00bafbb8b198033 100644 (file)
--- 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 }
 };
 
index 13e97098ed7c05ae97b3a0f07c1273312e0ac000..a22a6a6a1bca87584b76333c43b1f38107275e21 100644 (file)
--- 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
 };
 
index 9809767e1264d8fe4b43af8052ae153dc6007d8b..a5359df81ed84fd10c28a3dcab18f76f5ff78094 100644 (file)
@@ -47,3 +47,4 @@ set address_style=eu
 # use ASCII characters only
 set use_ascii_only=false
 
+set add_email_prevent_duplicates=false