/** * This event is triggered when a PROPPATCH method is executed * * @param array $mutations * @param array $result * @param DAV\INode $node * @return bool */ public function updateProperties(&$mutations, &$result, DAV\INode $node) { if (!$node instanceof UserAddressBooks) { return true; } $meCard = '{http://calendarserver.org/ns/}me-card'; // The only property we care about if (!isset($mutations[$meCard])) { return true; } $value = $mutations[$meCard]; unset($mutations[$meCard]); if ($value instanceof DAV\Property\IHref) { $value = $value->getHref(); $value = $this->server->calculateUri($value); } elseif (!is_null($value)) { $result[400][$meCard] = null; return false; } $innerResult = $this->server->updateProperties($node->getOwner(), array('{http://sabredav.org/ns}vcard-url' => $value)); $closureResult = false; foreach ($innerResult as $status => $props) { if (is_array($props) && array_key_exists('{http://sabredav.org/ns}vcard-url', $props)) { $result[$status][$meCard] = null; $closureResult = $status >= 200 && $status < 300; } } return $result; }