From c56f1f5046e1c4f66384197ecf163d60751667f4 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Wed, 04 Aug 2010 04:15:17 -0400
Subject: [PATCH] - Support vCards without or with an empty FN

---
 program/include/rcube_vcard.php |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/program/include/rcube_vcard.php b/program/include/rcube_vcard.php
index 320607b..0ed7be7 100644
--- a/program/include/rcube_vcard.php
+++ b/program/include/rcube_vcard.php
@@ -86,6 +86,13 @@
       $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], '@'))));
+    }
   }
 
 

--
Gitblit v1.9.1