Skip to content

Commit

Permalink
location is an AirSyncBaseLocation object in EAS 16.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Aug 31, 2016
1 parent ac5d8c3 commit f6932b3
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions kronolith/lib/Event.php
Expand Up @@ -1677,8 +1677,14 @@ public function fromASAppointment(Horde_ActiveSync_Message_Appointment $message)
}
}

if (!$message->isGhosted('location') &&
strlen($location = $message->getLocation())) {
// EAS 16 location property is an AirSyncBaseLocation object, not
// a string.
$location = $message->getLocation();
if (is_object($location)) {
// @todo - maybe build a more complete name based on city/country?
$location = $location->displayname;
}
if (!$message->isGhosted('location') && strlen($location)) {
$this->location = $location;
}

Expand Down Expand Up @@ -2037,7 +2043,19 @@ public function toASAppointment(array $options = array())
} else {
$message->setBody($this->description);
}
$message->setLocation($this->location);
if ($options['protocolversion'] >= Horde_ActiveSync::VERSION_SIXTEEN && !empty($this->location)) {
$message->location = new Horde_ActiveSync_Message_AirSyncBaseLocation(
array(
'logger' => $GLOBALS['injector']->getInstance('Horde_Log_Logger'),
'protocolversion' => $options['protocolversion']
)
);
// @todo - worth it to try to get full city/country etc...
// from geotagging service if available??
$message->location->displayname = $this->location;
} else {
$message->setLocation($this->location);
}
}

$message->setSubject($this->getTitle());
Expand Down

0 comments on commit f6932b3

Please sign in to comment.