From 3e1c094ee56ac58ca475bd71c4b7c6a1e6805849 Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Thu, 29 Jan 2009 13:07:07 +0100 Subject: [PATCH] MFB: 1.34.10.24 We already parse the vCard data in the MIME viewer, and most importantly: with the correct charset. So we shouldn't do this again in the API method, where we don't have access to the charset specified in the MIME part. Bug: 7816 --- framework/Mime/lib/Horde/Mime/Viewer/vcard.php | 34 +++++++++++++++----------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/framework/Mime/lib/Horde/Mime/Viewer/vcard.php b/framework/Mime/lib/Horde/Mime/Viewer/vcard.php index 1d9fcbabe..2932b9508 100644 --- a/framework/Mime/lib/Horde/Mime/Viewer/vcard.php +++ b/framework/Mime/lib/Horde/Mime/Viewer/vcard.php @@ -67,21 +67,27 @@ class Horde_Mime_Viewer_vcard extends Horde_Mime_Viewer_Driver Util::getFormData('source') && $registry->hasMethod('contacts/import')) { $source = Util::getFormData('source'); - $contacts = $registry->call('contacts/import', - array($data, 'text/x-vcard', $source)); - if (is_a($contacts, 'PEAR_Error')) { - $notification->push( - _("There was an error importing the contact data:") . ' ' - . $contacts->getMessage(), - 'horde.error'); - } else { - $notification->push(sprintf(ngettext( - "%d contact was successfully added to your address book.", - "%d contacts were successfully added to your address book.", - $iCal->getComponentCount()), - $iCal->getComponentCount()), - 'horde.success'); + $count = 0; + foreach ($iCal->getComponents() as $c) { + if (is_a($c, 'Horde_iCalendar_vcard')) { + $contacts = $registry->call('contacts/import', + array($c, null, $source)); + if (is_a($contacts, 'PEAR_Error')) { + $notification->push( + _("There was an error importing the contact data:") . ' ' + . $contacts->getMessage(), + 'horde.error'); + continue; + } + $count++; + } } + $notification->push(sprintf(ngettext( + "%d contact was successfully added to your address book.", + "%d contacts were successfully added to your address book.", + $count), + $count), + 'horde.success'); } $html .= ''; -- 2.11.0