diff options
author | Thomas Tanghus <thomas@tanghus.net> | 2012-01-19 19:47:09 +0100 |
---|---|---|
committer | Thomas Tanghus <thomas@tanghus.net> | 2012-01-19 19:47:09 +0100 |
commit | ca03a26f150f957222aacc99bf5f60b0019b3625 (patch) | |
tree | 2f96ac2b2a0979f0939c61dbee1ce3d710fd0abd /apps/contacts/lib/vcard.php | |
parent | 137c63037704f85ebcba4ce4725750fd68a23c22 (diff) | |
download | nextcloud-server-ca03a26f150f957222aacc99bf5f60b0019b3625.tar.gz nextcloud-server-ca03a26f150f957222aacc99bf5f60b0019b3625.zip |
- Added fix for empty 'FN' field on import via CardDAV clients.
- Make sure that the contact in the list has a display name.
- More tweaks on thumbnail caching.
Diffstat (limited to 'apps/contacts/lib/vcard.php')
-rw-r--r-- | apps/contacts/lib/vcard.php | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/apps/contacts/lib/vcard.php b/apps/contacts/lib/vcard.php index 04b59a040fb..c99d53c9716 100644 --- a/apps/contacts/lib/vcard.php +++ b/apps/contacts/lib/vcard.php @@ -159,15 +159,27 @@ class OC_Contacts_VCard{ */ public static function addFromDAVData($id,$uri,$data){ $fn = null; + $email = null; $card = OC_VObject::parse($data); if(!is_null($card)){ foreach($card->children as $property){ if($property->name == 'FN'){ $fn = $property->value; - break; + } + if($property->name == 'EMAIL' && is_null($email)){ + $email = $property->value; } } } + if(!$fn) { + if($email) { + $fn = $email; + } else { + $fn = 'Unknown'; + } + $card->addProperty('EMAIL', $email); + $data = $card->serialize(); + } $stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*contacts_cards (addressbookid,fullname,carddata,uri,lastmodified) VALUES(?,?,?,?,?)' ); $result = $stmt->execute(array($id,$fn,$data,$uri,time())); |