public function _saveRecipients(Horde_Mail_Rfc822_List $recipients)
{
global $notification, $prefs, $registry;
if (!$prefs->getValue('save_recipients') || !$registry->hasMethod('contacts/import') || !($abook = $prefs->getValue('add_source'))) {
return;
}
foreach ($recipients as $recipient) {
$name = is_null($recipient->personal) ? $recipient->mailbox : $recipient->personal;
try {
$registry->call('contacts/import', array(array('name' => $name, 'email' => $recipient->bare_address), 'array', $abook, array('match_on_email' => true)));
$notification->push(sprintf(_("Entry \"%s\" was successfully added to the address book"), $name), 'horde.success');
} catch (Turba_Exception_ObjectExists $e) {
} catch (Horde_Exception $e) {
if ($e->getCode() == 'horde.error') {
$notification->push($e, $e->getCode());
}
}
}
}