From e73c2f069b2715749ed7c81f9105396fb1bcbace Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Fri, 7 May 2010 19:39:21 -0400 Subject: [PATCH] Use the new calendar/getChanges method. Still need to implement for contacts and tasks --- .../lib/Horde/ActiveSync/Driver/Horde.php | 8 +++++--- .../ActiveSync/Driver/Horde/Connector/Registry.php | 22 +++++++++++++++++++++- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/framework/ActiveSync/lib/Horde/ActiveSync/Driver/Horde.php b/framework/ActiveSync/lib/Horde/ActiveSync/Driver/Horde.php index 9d6a9c535..1772c6784 100644 --- a/framework/ActiveSync/lib/Horde/ActiveSync/Driver/Horde.php +++ b/framework/ActiveSync/lib/Horde/ActiveSync/Driver/Horde.php @@ -290,9 +290,11 @@ class Horde_ActiveSync_Driver_Horde extends Horde_ActiveSync_Driver_Base $edits = $deletes = array(); } else { try { - $adds = $this->_connector->calendar_listBy('add', $from_ts, $to_ts); - $edits = $this->_connector->calendar_listBy('modify', $from_ts, $to_ts); - $deletes = $this->_connector->calendar_listBy('delete', $from_ts, $to_ts); + $changes = $this->_connector->calendar_getChanges($from_ts, $to_ts); + // @TODO: these assignments are just until all collections are refactored. + $adds = $changes['add']; + $edits = $changes['modify']; + $deletes = $changes['delete']; } catch (Horde_Exception $e) { $this->_logger->err($e->getMessage()); return array(); diff --git a/framework/ActiveSync/lib/Horde/ActiveSync/Driver/Horde/Connector/Registry.php b/framework/ActiveSync/lib/Horde/ActiveSync/Driver/Horde/Connector/Registry.php index b9a1ca076..a190e56e6 100644 --- a/framework/ActiveSync/lib/Horde/ActiveSync/Driver/Horde/Connector/Registry.php +++ b/framework/ActiveSync/lib/Horde/ActiveSync/Driver/Horde/Connector/Registry.php @@ -77,13 +77,33 @@ class Horde_ActiveSync_Driver_Horde_Connector_Registry public function calendar_listBy($action, $from_ts, $to_ts) { try { - return $this->_registry->calendar->listBy($action, $from_ts, null, $to_ts); + $uids = $this->_registry->calendar->listBy($action, $from_ts, null, $to_ts); } catch (Exception $e) { return array(); } } /** + * Obtain all calendar server chages that occured in the specified time + * interval. + * + * @param integer $from_ts Starting timestamp + * @param integer $to_ts Ending timestamp + * + * @return array Hash of add, modify, and delete arrays + */ + public function calendar_getChanges($from_ts, $to_ts) + { + try { + return $this->_registry->calendar->getChanges($from_ts, $to_ts); + } catch (Exception $e) { + return array('add' => array(), + 'modify' => array(), + 'delete' => array()); + } + } + + /** * Export the specified event as an ActiveSync message * * @param string $uid The calendar id -- 2.11.0