diff options
author | thomascube <thomas@roundcube.net> | 2011-05-13 18:08:37 +0000 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2011-05-13 18:08:37 +0000 |
commit | 6b19999841f97e1addfa6ebce79a887aad7467c9 (patch) | |
tree | 1ec019d304979a01af367c097acc596e86bf8306 /program/include | |
parent | 445a4ca04dfcd255f9d89ee76757b04c2d87bbfc (diff) |
Correctly handle empty contact names when importing
Diffstat (limited to 'program/include')
-rw-r--r-- | program/include/rcube_vcard.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/program/include/rcube_vcard.php b/program/include/rcube_vcard.php index 4457bf3c9..40ec353e5 100644 --- a/program/include/rcube_vcard.php +++ b/program/include/rcube_vcard.php @@ -95,6 +95,10 @@ class rcube_vcard ($detected_charset = self::detect_encoding(self::vcard_encode($this->raw))) && $detected_charset != RCMAIL_CHARSET) { $this->raw = self::charset_convert($this->raw, $detected_charset); } + + // consider FN empty if the same as the primary e-mail address + if ($this->raw['FN'][0][0] == $this->raw['EMAIL'][0][0]) + $this->raw['FN'][0][0] = ''; // find well-known address fields $this->displayname = $this->raw['FN'][0][0]; @@ -402,7 +406,7 @@ class rcube_vcard if (preg_match('/^END:VCARD$/i', $line)) { // parse vcard $obj = new rcube_vcard(self::cleanup($vcard_block), $charset, true); - if (!empty($obj->displayname)) + if (!empty($obj->displayname) || !empty($obj->email)) $out[] = $obj; $in_vcard_block = false; |