Skip to content

Commit

Permalink
Check for broken iOS picture behavior.
Browse files Browse the repository at this point in the history
...but allow to override this from client code if desired.
  • Loading branch information
mrubinsk committed May 11, 2016
1 parent 989687a commit d524e5f
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions framework/ActiveSync/lib/Horde/ActiveSync/Message/Contact.php
Expand Up @@ -440,10 +440,13 @@ protected function _formatDate(Horde_Date $dt, $type)
* by the client AND is NOT present in the request data.
*
* @param string $property The property to check
* @param array $options An array of options:
* - ignoreEmptyPictureTagCheck: boolean If true, will not check for the
* QUIRK_INCORRECTLY_SENDS_EMPTY_PICTURE_TAG quirk. @since 2.32.0
*
* @return boolean
*/
public function isGhosted($property)
public function isGhosted($property, $options = array())
{
// MS-ASCMD 2.2.3.168:
// An empty SUPPORTED container indicates that ALL elements able to be
Expand All @@ -452,11 +455,19 @@ public function isGhosted($property)
// NOT ghosted. Some clients like iOS 4.x screw this up by not sending
// any SUPPORTED container and also not sending the picture field during
// edits.
if ($property == $this->_mapping[self::PICTURE][self::KEY_ATTRIBUTE] &&
empty($this->_exists[$property]) &&
empty($this->_supported) &&
$this->_device->hasQuirk(Horde_ActiveSync_Device::QUIRK_NEEDS_SUPPORTED_PICTURE_TAG)) {
return true;
if ($property == $this->_mapping[self::PICTURE][self::KEY_ATTRIBUTE]) {
if (empty($options['ignoreEmptyPictureTagCheck']) &&
$this->_device->hasQuirk(Horde_ActiveSync_Device::QUIRK_INCORRECTLY_SENDS_EMPTY_PICTURE_TAG) &&
!empty($this->_exists[$property]) &&
$this->{$property} == '') {
return true;
}

if (empty($this->_exists[$property]) &&
empty($this->_supported) &&
$this->_device->hasQuirk(Horde_ActiveSync_Device::QUIRK_NEEDS_SUPPORTED_PICTURE_TAG)) {
return true;
}
}

return parent::isGhosted($property);
Expand Down

0 comments on commit d524e5f

Please sign in to comment.