Use the new calendar/getChanges method.
authorMichael J. Rubinsky <mrubinsk@horde.org>
Fri, 7 May 2010 23:39:21 +0000 (19:39 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Fri, 7 May 2010 23:42:03 +0000 (19:42 -0400)
Still need to implement for contacts and tasks

framework/ActiveSync/lib/Horde/ActiveSync/Driver/Horde.php
framework/ActiveSync/lib/Horde/ActiveSync/Driver/Horde/Connector/Registry.php

index 9d6a9c5..1772c67 100644 (file)
@@ -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();
index b9a1ca0..a190e56 100644 (file)
@@ -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