From e848180aaa9640de871796ca1a3e4f8110701fd6 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Thu, 12 May 2011 16:18:19 -0400
Subject: [PATCH] Improve display name composition when saving contacts (#1487143), with plugin-support; allow empty names in sql address book, fall back to e-mail address in listing and vcard export
---
program/include/rcube_vcard.php | 11 ++++-------
1 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/program/include/rcube_vcard.php b/program/include/rcube_vcard.php
index 0cb0b20..4457bf3 100644
--- a/program/include/rcube_vcard.php
+++ b/program/include/rcube_vcard.php
@@ -115,13 +115,6 @@
$this->email[0] = $this->email[$pref_index];
$this->email[$pref_index] = $tmp;
}
-
- // make sure displayname is not empty (required by RFC2426)
- if (!strlen($this->displayname)) {
- // the same method is used in steps/mail/addcontact.inc
- $this->displayname = ucfirst(preg_replace('/[\.\-]/', ' ',
- substr($this->email[0], 0, strpos($this->email[0], '@'))));
- }
}
@@ -585,6 +578,10 @@
while ($type == "N" && is_array($entries[0]) && count($entries[0]) < 5)
$entries[0][] = "";
+ // make sure FN is not empty (required by RFC2426)
+ if ($type == "FN" && empty($entries))
+ $entries[0] = $data['EMAIL'][0][0];
+
foreach((array)$entries as $entry) {
$attr = '';
if (is_array($entry)) {
--
Gitblit v1.9.1