From bb8781c6d756c76c65e3cdce4f53bf9cca2f9193 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Thu, 25 Sep 2008 09:51:24 -0400
Subject: [PATCH] Improve vcard decoding and import step

---
 program/steps/addressbook/import.inc |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/program/steps/addressbook/import.inc b/program/steps/addressbook/import.inc
index a0786e2..93452ec 100644
--- a/program/steps/addressbook/import.inc
+++ b/program/steps/addressbook/import.inc
@@ -124,6 +124,12 @@
     foreach ($vcards as $vcard) {
       $email = $vcard->email[0];
       
+      // skip entries without an e-mail address
+      if (empty($email)) {
+        $IMPORT_STATS->nomail++;
+        continue;
+      }
+      
       if (!$replace) {
         // compare e-mail address
         $existing = $CONTACTS->search('email', $email, false, false);
@@ -134,11 +140,6 @@
           $IMPORT_STATS->skipped++;
           continue;
         }
-      }
-      // skip entries without an e-mail address
-      if (empty($email)) {
-        $IMPORT_STATS->nomail++;
-        continue;
       }
       
       $success = $CONTACTS->insert(array(

--
Gitblit v1.9.1