]> git.deb.at Git - pkg/abook.git/commitdiff
add-email: fixed a spurious "Valid sender address not found" in interactive-mode
authorRaphaël Droz <raphael.droz+floss@gmail.com>
Thu, 16 Jan 2014 12:51:40 +0000 (13:51 +0100)
committerRaphaël Droz <raphael.droz+floss@gmail.com>
Thu, 16 Jan 2014 12:51:40 +0000 (13:51 +0100)
 when one of several emails addition is refused.

Original patch from Daniel <quite@hack.org>
Reported-by: Daniel <quite@hack.org>
abook.c

diff --git a/abook.c b/abook.c
index 1651267a541ef44bc5352786ca121777ce298fd3..37495613125918debf97c9541ab79a7c5c7c3579 100644 (file)
--- a/abook.c
+++ b/abook.c
@@ -704,7 +704,7 @@ convert(char *srcformat, char *srcfile, char *dstformat, char *dstfile)
  * --add-email handling
  */
 
-static int add_email_count = 0;
+static int add_email_count = 0, add_email_found = 0;
 
 static void
 quit_add_email()
@@ -715,7 +715,7 @@ quit_add_email()
                        exit(EXIT_FAILURE);
                }
                printf(_("%d item(s) added to %s\n"), add_email_count, datafile);
-       } else {
+       } else if (add_email_found == 0) {
                puts(_("Valid sender address not found"));
        }
 
@@ -814,6 +814,7 @@ add_email(int quiet)
        do {
                line = getaline(stdin);
                if(line && !strncasecmp("From:", line, 5) ) {
+                       add_email_found++;
                        getname(line, &name, &email);
                        add_email_count += add_email_add_item(quiet,
                                        name, email);