Rename a bunch of classes and combine a few to better reflect what is happening here.
As a bonus, cleans up the main directory of the package a bit.
$device->userAgent = $this->_request->getHeader('User-Agent');
$device->deviceType = !empty($get['DeviceType']) ? $get['DeviceType'] : '';
$device->policykey = 0;
+ $device->rwstatus = 0;
$state->setDeviceInfo($devId, $device);
}
--- /dev/null
+<?php
+/**
+ * File : streamimporter.php
+ * Project : Z-Push
+ * Descr : Stream import classes
+ *
+ * Created : 01.10.2007
+ *
+ * � Zarafa Deutschland GmbH, www.zarafaserver.de
+ * This file is distributed under GPL v2.
+ * Consult LICENSE file for details
+ */
+
+/**
+ *
+ *
+ */
+class Horde_ActiveSync_Connector_Exporter
+{
+ protected $_encoder;
+ protected $_type;
+ protected $_seenObjects;
+
+ public $changed = array();
+ public $deleted = array();
+ public $count = 0;
+
+ /**
+ * Const'r
+ *
+ * @param Horde_ActiveSync_Wbxml_Encoder $encoder
+ * @param string $class The collection class
+ *
+ * @return Horde_ActiveSync_Connector_Exporter
+ */
+ public function __construct($encoder = null, $class = null)
+ {
+ $this->_encoder = $encoder;
+ $this->_type = $class;
+ $this->_seenObjects = array();
+ }
+
+ /**
+ *
+ * @param $id
+ * @param $message
+ * @return unknown_type
+ */
+ public function messageChange($id, $message)
+ {
+ if ($message->getClass() != $this->_type) {
+ return true; // ignore other types
+ }
+
+ // prevent sending the same object twice in one request
+ if (in_array($id, $this->_seenObjects)) {
+ return true;
+ }
+
+ $this->_seenObjects[] = $id;
+ if ($message->flags === false || $message->flags === SYNC_NEWMESSAGE) {
+ $this->_encoder->startTag(SYNC_ADD);
+ } else {
+ $this->_encoder->startTag(SYNC_MODIFY);
+ }
+
+ $this->_encoder->startTag(SYNC_SERVERENTRYID);
+ $this->_encoder->content($id);
+ $this->_encoder->endTag();
+ $this->_encoder->startTag(SYNC_DATA);
+ $message->encodeStream($this->_encoder);
+ $this->_encoder->endTag();
+ $this->_encoder->endTag();
+
+ return true;
+ }
+
+ /**
+ *
+ * @param $id
+ * @return unknown_type
+ */
+ public function messageDeletion($id)
+ {
+ $this->_encoder->startTag(SYNC_REMOVE);
+ $this->_encoder->startTag(SYNC_SERVERENTRYID);
+ $this->_encoder->content($id);
+ $this->_encoder->endTag();
+ $this->_encoder->endTag();
+
+ return true;
+ }
+
+ /**
+ *
+ * @param $id
+ * @param $flags
+ * @return unknown_type
+ */
+ public function messageReadFlag($id, $flags)
+ {
+ if ($this->_type != "syncmail") {
+ return true;
+ }
+ $this->_encoder->startTag(SYNC_MODIFY);
+ $this->_encoder->startTag(SYNC_SERVERENTRYID);
+ $this->_encoder->content($id);
+ $this->_encoder->endTag();
+ $this->_encoder->startTag(SYNC_DATA);
+ $this->_encoder->startTag(SYNC_POOMMAIL_READ);
+ $this->_encoder->content($flags);
+ $this->_encoder->endTag();
+ $this->_encoder->endTag();
+ $this->_encoder->endTag();
+
+ return true;
+ }
+
+ /**
+ *
+ * @param $message
+ * @return unknown_type
+ */
+ function messageMove($message)
+ {
+ return true;
+ }
+
+ /**
+ *
+ * @param <type> $folder
+ * @return <type>
+ */
+ public function FolderChange($folder)
+ {
+ array_push($this->changed, $folder);
+ $this->count++;
+
+ return true;
+ }
+
+ /**
+ *
+ * @param <type> $id
+ * @return <type>
+ */
+ public function FolderDeletion($id)
+ {
+ array_push($this->deleted, $id);
+ $this->count++;
+
+ return true;
+ }
+}
\ No newline at end of file
--- /dev/null
+<?php
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+class Horde_ActiveSync_Connector_Importer
+{
+ /**
+ *
+ * @var Horde_ActiveSync_StateMachine_Base
+ */
+ protected $_stateMachine;
+
+ /**
+ *
+ * @var Horde_ActiveSync_Driver_Base
+ */
+ protected $_backend;
+
+ /**
+ * Sync key for current request
+ *
+ * @var string
+ */
+ protected $_syncKey;
+
+ /**
+ * @TODO
+ * @var <type>
+ */
+ protected $_flags;
+
+ /**
+ * The server specific folder id
+ *
+ * @var string
+ */
+ protected $_folderId;
+
+ protected $_logger;
+
+ /**
+ * Const'r
+ *
+ * @param Horde_ActiveSync_Driver_Base $backend
+ * @param Horde_ActiveSync_StateMachine_Base $stateMachine
+ * @param <type> $syncKey
+ * @param <type> $flags
+ */
+ public function __construct(Horde_ActiveSync_Driver_Base $backend)
+ {
+ $this->_backend = $backend;
+ }
+
+ public function init(Horde_ActiveSync_State_Base &$stateMachine,
+ $folderId, $syncKey, $flags = 0)
+ {
+ $this->_stateMachine = &$stateMachine;
+ $this->_syncKey = $syncKey;
+ $this->_flags = $flags;
+ $this->_folderId = $folderId;
+ }
+
+ public function setLogger($logger)
+ {
+ $this->_logger = $logger;
+ }
+
+ /**
+ *
+ * @param mixed $id A server message id or
+ * false if a new message
+ * @param Horde_ActiveSync_Message_Base $message A message object
+ *
+ * @return mixed The server message id or false
+ */
+ public function ImportMessageChange($id, $message)
+ {
+ //do nothing if it is in a dummy folder
+ if ($this->_folderId == SYNC_FOLDER_TYPE_DUMMY) {
+ return false;
+ }
+
+ if ($id) {
+ // See if there's a conflict
+ $conflict = $this->_isConflict('change', $this->_folderId, $id);
+
+ // Update client state if this is an update
+ $change = array();
+ $change['id'] = $id;
+ $change['mod'] = 0; // dummy, will be updated later if the change succeeds
+ $change['parent'] = $this->_folderId;
+ $change['flags'] = (isset($message->read)) ? $message->read : 0;
+ $this->_stateMachine->updateState('change', $change);
+
+ if ($conflict && $this->_flags == SYNC_CONFLICT_OVERWRITE_PIM) {
+ return true;
+ }
+ }
+
+ $stat = $this->_backend->ChangeMessage($this->_folderId, $id, $message);
+ // @TODO: Isn't this an error?
+ if (!is_array($stat)) {
+ return $stat;
+ }
+
+ // Record the state of the message
+ $this->_stateMachine->updateState('change', $stat);
+
+ return $stat['id'];
+ }
+
+ /**
+ * Import a deletion. This may conflict if the local object has been
+ * modified.
+ *
+ * @param string $id Server message id
+ */
+ public function ImportMessageDeletion($id)
+ {
+ //do nothing if it is in a dummy folder
+ if ($this->_folderId == SYNC_FOLDER_TYPE_DUMMY) {
+ return true;
+ }
+
+ // See if there's a conflict
+ $conflict = $this->_isConflict('delete', $this->_folderId, $id);
+
+ // Update client state
+ $change = array();
+ $change['id'] = $id;
+ $this->_stateMachine->updateState('delete', $change);
+
+ // If there is a conflict, and the server 'wins', then return OK without
+ // performing the change this will cause the exporter to 'see' the
+ // overriding item as a change, and send it back to the PIM
+ if ($conflict && $this->_flags == SYNC_CONFLICT_OVERWRITE_PIM) {
+ return true;
+ }
+
+ $this->_backend->DeleteMessage($this->_folderId, $id);
+
+ return true;
+ }
+
+ /**
+ * Import a change in 'read' flags .. This can never conflict
+ *
+ * @param string $id Server message id
+ * @param ?? $flags The read flags to set
+ */
+ public function ImportMessageReadFlag($id, $flags)
+ {
+ //do nothing if it is a dummy folder
+ if ($this->_folderId == SYNC_FOLDER_TYPE_DUMMY) {
+ return true;
+ }
+
+ // Update client state
+ $change = array();
+ $change['id'] = $id;
+ $change['flags'] = $flags;
+ $this->_stateMachine->updateState('flags', $change);
+ $this->_backend->SetReadFlag($this->_folderId, $id, $flags);
+
+ return true;
+ }
+
+ /**
+ * Not supported/todo?
+ *
+ * @param <type> $id
+ * @param <type> $newfolder
+ * @return <type>
+ */
+ public function ImportMessageMove($id, $newfolder)
+ {
+ return true;
+ }
+
+ /**
+ *
+ * @param $id
+ * @param $parent
+ * @param $displayname
+ * @param $type
+ * @return unknown_type
+ */
+ public function ImportFolderChange($id, $parent, $displayname, $type)
+ {
+ //do nothing if it is a dummy folder
+ if ($parent == SYNC_FOLDER_TYPE_DUMMY) {
+ return false;
+ }
+
+ if ($id) {
+ $change = array();
+ $change['id'] = $id;
+ $change['mod'] = $displayname;
+ $change['parent'] = $parent;
+ $change['flags'] = 0;
+ $this->_stateMachine->updateState('change', $change);
+ }
+
+ // @TODO: ChangeFolder did not exist in ZPush's code??
+ $stat = $this->_backend->ChangeFolder($parent, $id, $displayname, $type);
+ if ($stat) {
+ $this->_stateMachine->updateState('change', $stat);
+ }
+
+ return $stat['id'];
+ }
+
+ /**
+ *
+ * @param $id
+ * @param $parent
+ * @return unknown_type
+ */
+ public function ImportFolderDeletion($id, $parent)
+ {
+ //do nothing if it is a dummy folder
+ if ($parent == SYNC_FOLDER_TYPE_DUMMY) {
+ return false;
+ }
+
+ $change = array();
+ $change['id'] = $id;
+
+ $this->_stateMachine->updateState('delete', $change);
+ $this->_backend->DeleteFolder($parent, $id);
+
+ return true;
+ }
+
+ /**
+ * Returns TRUE if the given ID conflicts with the given operation.
+ * This is only true in the following situations:
+ *
+ * Changed here and changed there
+ * Changed here and deleted there
+ * Deleted here and changed there
+ *
+ * Any other combination of operations can be done
+ * (e.g. change flags & move or move & delete)
+ */
+ protected function _isConflict($type, $folderid, $id)
+ {
+ $stat = $this->_backend->StatMessage($folderid, $id);
+ if (!$stat) {
+ // Message is gone
+ if ($type == 'change') {
+ return true;
+ } else {
+ return false; // all other remote changes still result in a delete (no conflict)
+ }
+ }
+
+ return $this->_stateMachine->isConflict($stat, $type);
+ }
+
+}
--- /dev/null
+<?php
+/**
+ *
+ */
+class Horde_ActiveSync_Connector_NullImporter
+{
+ public function ImportMessageChange($id, $message) { return true; }
+ public function ImportMessageDeletion($id) { return true; }
+ public function ImportMessageReadFlag($id, $flags) { return true; }
+ public function ImportMessageMove($id, $newfolder) { return true; }
+}
\ No newline at end of file
+++ /dev/null
-<?php
-/**
- * @TODO: Can't figure out what this was meant to do, and in fact the
- * original Z-Push code that instantiates the Z-Push version of this class
- * called methods that don't exist here.
- *
- * Looks like it's just a sort of placeholder class??
- */
-class Horde_ActiveSync_ContentsCache
-{
- public function ImportMessageChange($message) { return true; }
- public function ImportMessageDeletion($message) { return true; }
- public function ImportMessageReadFlag($message) { return true; }
- public function ImportMessageMove($message) { return true; }
-}
\ No newline at end of file
/**
* @TODO: This will replace the above two methods
- * @return Horde_ActiveSync_Importer
+ * @return Horde_ActiveSync_Connector_Importer
*/
public function getImporter()
{
- $importer = new Horde_ActiveSync_Importer($this);
- //$importer->setLogger($this->_logger);
+ $importer = new Horde_ActiveSync_Connector_Importer($this);
return $importer;
}
+++ /dev/null
-<?php
-/**
- * This simply collects all changes so that they can be retrieved later, for
- * statistics gathering for example
- */
-/**
- * File : memimporter.php
- * Project : Z-Push
- * Descr : Classes that collect changes
- *
- * Created : 01.10.2007
- *
- * © Zarafa Deutschland GmbH, www.zarafaserver.de
- * This file is distributed under GPL v2.
- * Consult LICENSE file for details
- */
-class Horde_ActiveSync_HierarchyCache
-{
- public $changed;
- public $deleted;
- public $count;
-
- public function __construct()
- {
- $this->changed = array();
- $this->deleted = array();
- $this->count = 0;
-
- return true;
- }
-
- public function FolderChange($folder)
- {
- array_push($this->changed, $folder);
- $this->count++;
-
- return true;
- }
-
- public function FolderDeletion($id)
- {
- array_push($this->deleted, $id);
- $this->count++;
-
- return true;
- }
-}
\ No newline at end of file
+++ /dev/null
-<?php
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-class Horde_ActiveSync_Importer
-{
- /**
- *
- * @var Horde_ActiveSync_StateMachine_Base
- */
- protected $_stateMachine;
-
- /**
- *
- * @var Horde_ActiveSync_Driver_Base
- */
- protected $_backend;
-
- /**
- * Sync key for current request
- *
- * @var string
- */
- protected $_syncKey;
-
- /**
- * @TODO
- * @var <type>
- */
- protected $_flags;
-
- /**
- * The server specific folder id
- *
- * @var string
- */
- protected $_folderId;
-
- protected $_logger;
-
- /**
- * Const'r
- *
- * @param Horde_ActiveSync_Driver_Base $backend
- * @param Horde_ActiveSync_StateMachine_Base $stateMachine
- * @param <type> $syncKey
- * @param <type> $flags
- */
- public function __construct(Horde_ActiveSync_Driver_Base $backend)
- {
- $this->_backend = $backend;
- }
-
- public function init(Horde_ActiveSync_State_Base &$stateMachine,
- $folderId, $syncKey, $flags = 0)
- {
- $this->_stateMachine = &$stateMachine;
- $this->_syncKey = $syncKey;
- $this->_flags = $flags;
- $this->_folderId = $folderId;
- }
-
- public function setLogger($logger)
- {
- $this->_logger = $logger;
- }
-
- /**
- *
- * @param mixed $id A server message id or
- * false if a new message
- * @param Horde_ActiveSync_Message_Base $message A message object
- *
- * @return mixed The server message id or false
- */
- public function ImportMessageChange($id, $message)
- {
- //do nothing if it is in a dummy folder
- if ($this->_folderId == SYNC_FOLDER_TYPE_DUMMY) {
- return false;
- }
-
- if ($id) {
- // See if there's a conflict
- $conflict = $this->_isConflict('change', $this->_folderId, $id);
-
- // Update client state if this is an update
- $change = array();
- $change['id'] = $id;
- $change['mod'] = 0; // dummy, will be updated later if the change succeeds
- $change['parent'] = $this->_folderId;
- $change['flags'] = (isset($message->read)) ? $message->read : 0;
- $this->_stateMachine->updateState('change', $change);
-
- if ($conflict && $this->_flags == SYNC_CONFLICT_OVERWRITE_PIM) {
- return true;
- }
- }
-
- $stat = $this->_backend->ChangeMessage($this->_folderId, $id, $message);
- // @TODO: Isn't this an error?
- if (!is_array($stat)) {
- return $stat;
- }
-
- // Record the state of the message
- $this->_stateMachine->updateState('change', $stat);
-
- return $stat['id'];
- }
-
- /**
- * Import a deletion. This may conflict if the local object has been
- * modified.
- *
- * @param string $id Server message id
- */
- public function ImportMessageDeletion($id)
- {
- //do nothing if it is in a dummy folder
- if ($this->_folderId == SYNC_FOLDER_TYPE_DUMMY) {
- return true;
- }
-
- // See if there's a conflict
- $conflict = $this->_isConflict('delete', $this->_folderId, $id);
-
- // Update client state
- $change = array();
- $change['id'] = $id;
- $this->_stateMachine->updateState('delete', $change);
-
- // If there is a conflict, and the server 'wins', then return OK without
- // performing the change this will cause the exporter to 'see' the
- // overriding item as a change, and send it back to the PIM
- if ($conflict && $this->_flags == SYNC_CONFLICT_OVERWRITE_PIM) {
- return true;
- }
-
- $this->_backend->DeleteMessage($this->_folderId, $id);
-
- return true;
- }
-
- /**
- * Import a change in 'read' flags .. This can never conflict
- *
- * @param string $id Server message id
- * @param ?? $flags The read flags to set
- */
- public function ImportMessageReadFlag($id, $flags)
- {
- //do nothing if it is a dummy folder
- if ($this->_folderId == SYNC_FOLDER_TYPE_DUMMY) {
- return true;
- }
-
- // Update client state
- $change = array();
- $change['id'] = $id;
- $change['flags'] = $flags;
- $this->_stateMachine->updateState('flags', $change);
- $this->_backend->SetReadFlag($this->_folderId, $id, $flags);
-
- return true;
- }
-
- /**
- * Not supported/todo?
- *
- * @param <type> $id
- * @param <type> $newfolder
- * @return <type>
- */
- public function ImportMessageMove($id, $newfolder)
- {
- return true;
- }
-
- /**
- *
- * @param $id
- * @param $parent
- * @param $displayname
- * @param $type
- * @return unknown_type
- */
- public function ImportFolderChange($id, $parent, $displayname, $type)
- {
- //do nothing if it is a dummy folder
- if ($parent == SYNC_FOLDER_TYPE_DUMMY) {
- return false;
- }
-
- if ($id) {
- $change = array();
- $change['id'] = $id;
- $change['mod'] = $displayname;
- $change['parent'] = $parent;
- $change['flags'] = 0;
- $this->_stateMachine->updateState('change', $change);
- }
-
- // @TODO: ChangeFolder did not exist in ZPush's code??
- $stat = $this->_backend->ChangeFolder($parent, $id, $displayname, $type);
- if ($stat) {
- $this->_stateMachine->updateState('change', $stat);
- }
-
- return $stat['id'];
- }
-
- /**
- *
- * @param $id
- * @param $parent
- * @return unknown_type
- */
- public function ImportFolderDeletion($id, $parent)
- {
- //do nothing if it is a dummy folder
- if ($parent == SYNC_FOLDER_TYPE_DUMMY) {
- return false;
- }
-
- $change = array();
- $change['id'] = $id;
-
- $this->_stateMachine->updateState('delete', $change);
- $this->_backend->DeleteFolder($parent, $id);
-
- return true;
- }
-
- /**
- * Returns TRUE if the given ID conflicts with the given operation.
- * This is only true in the following situations:
- *
- * Changed here and changed there
- * Changed here and deleted there
- * Deleted here and changed there
- *
- * Any other combination of operations can be done
- * (e.g. change flags & move or move & delete)
- */
- protected function _isConflict($type, $folderid, $id)
- {
- $stat = $this->_backend->StatMessage($folderid, $id);
- if (!$stat) {
- // Message is gone
- if ($type == 'change') {
- return true;
- } else {
- return false; // all other remote changes still result in a delete (no conflict)
- }
- }
-
- return $this->_stateMachine->isConflict($stat, $type);
- }
-}
\ No newline at end of file
// this is not done when sync'ing messages - we let the exporter write
// directly to WBXML.
// TODO: Combine all these import caches into a single Class
- $importer = new Horde_ActiveSync_HierarchyCache();
- $exporter = $this->_driver->GetSyncObject();
- $exporter->init($state, $importer, array('synckey' => $synckey));
+ $connector = new Horde_ActiveSync_Connector_Exporter();
+ $sync = $this->_driver->GetSyncObject();
+ $sync->init($state, $connector, array('synckey' => $synckey));
/* Perform the actual sync operation */
- while(is_array($exporter->syncronize()));
+ while(is_array($sync->syncronize()));
// Output our WBXML reply now
$this->_encoder->StartWBXML();
$this->_encoder->startTag(SYNC_FOLDERHIERARCHY_CHANGES);
$this->_encoder->startTag(SYNC_FOLDERHIERARCHY_COUNT);
- $this->_encoder->content($importer->count);
+ $this->_encoder->content($connector->count);
$this->_encoder->endTag();
- if (count($importer->changed) > 0) {
- foreach ($importer->changed as $folder) {
+ if (count($connector->changed) > 0) {
+ foreach ($connector->changed as $folder) {
if (isset($folder->serverid) && in_array($folder->serverid, $seenfolders)) {
$this->_encoder->startTag(SYNC_FOLDERHIERARCHY_UPDATE);
} else {
}
}
- if (count($importer->deleted) > 0) {
- foreach ($importer->deleted as $folder) {
+ if (count($connector->deleted) > 0) {
+ foreach ($connector->deleted as $folder) {
$this->_encoder->startTag(SYNC_FOLDERHIERARCHY_REMOVE);
$this->_encoder->startTag(SYNC_FOLDERHIERARCHY_SERVERENTRYID);
$this->_encoder->content($folder);
$this->_encoder->endTag();
$this->_encoder->startTag(SYNC_GETITEMESTIMATE_ESTIMATE);
- $importer = new Horde_ActiveSync_ContentsCache();
+ $importer = new Horde_ActiveSync_Connector_NullImporter();
$state = $this->_driver->getStateObject($collection);
$state->loadState($collection['synckey']);
$exporter = $this->_driver->getSyncObject();
/* Send server changes to PIM */
if (isset($collection['getchanges'])) {
$filtertype = isset($collection['filtertype']) ? $collection['filtertype'] : false;
- $streamer = new Horde_ActiveSync_Streamer($this->_encoder, $collection['class']);
- $exporter = $this->_driver->getSyncObject();
- $exporter->init($state, $streamer, $collection);
- $changecount = $exporter->getChangeCount();
+ $exporter = new Horde_ActiveSync_Connector_Exporter($this->_encoder, $collection['class']);
+ $sync = $this->_driver->getSyncObject();
+ $sync->init($state, $exporter, $collection);
+ $changecount = $sync->getChangeCount();
if (!empty($collection['windowsize']) && $changecount > $collection['windowsize']) {
$this->_encoder->startTag(SYNC_MOREAVAILABLE, false, true);
}
// Stream the changes to the PDA
$n = 0;
while (1) {
- $progress = $exporter->syncronize();
+ $progress = $sync->syncronize();
if (!is_array($progress)) {
break;
}
/* Save the sync state for the next time */
if (isset($collection['newsynckey'])) {
- if (!empty($exporter) || !empty($importer) || !empty($streamer) || $collection['synckey'] == 0) {
+ if (!empty($sync) || !empty($importer) || !empty($exporter) || $collection['synckey'] == 0) {
$state->setNewSyncKey($collection['newsynckey']);
$state->save();
} else {
+++ /dev/null
-<?php
-/**
- * File : streamimporter.php
- * Project : Z-Push
- * Descr : Stream import classes
- *
- * Created : 01.10.2007
- *
- * � Zarafa Deutschland GmbH, www.zarafaserver.de
- * This file is distributed under GPL v2.
- * Consult LICENSE file for details
- */
-
-/**
- *
- *
- */
-class Horde_ActiveSync_Streamer
-{
- protected $_encoder;
- protected $_type;
- protected $_seenObjects;
-
- /**
- * Const'r
- *
- * @param Horde_ActiveSync_Wbxml_Encoder $encoder
- * @param string $class The collection class
- *
- * @return Horde_ActiveSync_Streamer
- */
- public function __construct(&$encoder, $class)
- {
- $this->_encoder = &$encoder;
- $this->_type = $class;
- $this->_seenObjects = array();
- }
-
- /**
- *
- * @param $id
- * @param $message
- * @return unknown_type
- */
- public function messageChange($id, $message)
- {
- if ($message->getClass() != $this->_type) {
- return true; // ignore other types
- }
-
- // prevent sending the same object twice in one request
- if (in_array($id, $this->_seenObjects)) {
- return true;
- }
-
- $this->_seenObjects[] = $id;
- if ($message->flags === false || $message->flags === SYNC_NEWMESSAGE) {
- $this->_encoder->startTag(SYNC_ADD);
- } else {
- $this->_encoder->startTag(SYNC_MODIFY);
- }
-
- $this->_encoder->startTag(SYNC_SERVERENTRYID);
- $this->_encoder->content($id);
- $this->_encoder->endTag();
- $this->_encoder->startTag(SYNC_DATA);
- $message->encodeStream($this->_encoder);
- $this->_encoder->endTag();
- $this->_encoder->endTag();
-
- return true;
- }
-
- /**
- *
- * @param $id
- * @return unknown_type
- */
- public function messageDeletion($id)
- {
- $this->_encoder->startTag(SYNC_REMOVE);
- $this->_encoder->startTag(SYNC_SERVERENTRYID);
- $this->_encoder->content($id);
- $this->_encoder->endTag();
- $this->_encoder->endTag();
-
- return true;
- }
-
- /**
- *
- * @param $id
- * @param $flags
- * @return unknown_type
- */
- public function messageReadFlag($id, $flags)
- {
- if ($this->_type != "syncmail") {
- return true;
- }
- $this->_encoder->startTag(SYNC_MODIFY);
- $this->_encoder->startTag(SYNC_SERVERENTRYID);
- $this->_encoder->content($id);
- $this->_encoder->endTag();
- $this->_encoder->startTag(SYNC_DATA);
- $this->_encoder->startTag(SYNC_POOMMAIL_READ);
- $this->_encoder->content($flags);
- $this->_encoder->endTag();
- $this->_encoder->endTag();
- $this->_encoder->endTag();
-
- return true;
- }
-
- /**
- *
- * @param $message
- * @return unknown_type
- */
- function messageMove($message)
- {
- return true;
- }
-}
\ No newline at end of file
/**
* The change streamer
*
- * @var Horde_ActiveSync_Streamer
+ * @var Horde_ActiveSync_Connector_Exporter
*/
- protected $_streamer;
+ protected $_exporter;
protected $_logger;
}
public function init(Horde_ActiveSync_State_Base &$stateMachine,
- $streamer,
+ $exporter,
$collection = array())
{
$this->_stateMachine = &$stateMachine;
- $this->_streamer = $streamer;
+ $this->_exporter = $exporter;
$this->_folderId = !empty($collection['id']) ? $collection['id'] : false;
$this->_changes = $stateMachine->getChanges();
$this->_syncKey = $collection['synckey'];
return;
}
- if ($flags & BACKEND_DISCARD_DATA || $this->_streamer->FolderChange($folder)) {
+ if ($flags & BACKEND_DISCARD_DATA || $this->_exporter->FolderChange($folder)) {
$this->_stateMachine->updateState('change', $stat);
}
break;
case 'delete':
- if ($flags & BACKEND_DISCARD_DATA || $this->_streamer->FolderDeletion($change['id'])) {
+ if ($flags & BACKEND_DISCARD_DATA || $this->_exporter->FolderDeletion($change['id'])) {
$this->_stateMachine->updateState('delete', $change);
}
break;
$message->flags = (isset($change['flags'])) ? $change['flags'] : 0;
if ($stat && $message) {
- if ($flags & BACKEND_DISCARD_DATA || $this->_streamer->messageChange($change['id'], $message) == true) {
+ if ($flags & BACKEND_DISCARD_DATA || $this->_exporter->messageChange($change['id'], $message) == true) {
$this->_stateMachine->updateState('change', $stat);
}
}
break;
case 'delete':
- if ($flags & BACKEND_DISCARD_DATA || $this->_streamer->messageDeletion($change['id']) == true) {
+ if ($flags & BACKEND_DISCARD_DATA || $this->_exporter->messageDeletion($change['id']) == true) {
$this->_stateMachine->updateState('delete', $change);
}
break;
case 'flags':
- if ($flags & BACKEND_DISCARD_DATA || $this->_streamer->messageReadFlag($change['id'], $change['flags']) == true) {
+ if ($flags & BACKEND_DISCARD_DATA || $this->_exporter->messageReadFlag($change['id'], $change['flags']) == true) {
$this->_stateMachine->updateState('flags', $change);
}
break;
case 'move':
- if ($flags & BACKEND_DISCARD_DATA || $this->_streamer->messageMove($change['id'], $change['parent']) == true) {
+ if ($flags & BACKEND_DISCARD_DATA || $this->_exporter->messageMove($change['id'], $change['parent']) == true) {
$this->_stateMachine->updateState('move', $change);
}
break;
<dir name="lib">
<dir name="Horde">
<dir name="ActiveSync">
+ <dir name="Connector">
+ <file name="Exporter.php" role="php" />
+ <file name="Importer.php" role="php" />
+ <file name="NullImporter.php" role="php" />
+ </dir>
<dir name="State">
<file name="Base.php" role="php" />
<file name="File.php" role="php" />
<file name="GetItemEstimate.php" role="php" />
</dir>
<file name="Exception.php" role="php" />
- <file name="ContentsCache.php" role="php" />
- <file name="HierarchyCache.php" role="php" />
- <file name="ImportContentsChangesStream.php" role="php" />
<file name="Wbxml.php" role="php" />
<file name="Timezone.php" role="php" />
<file name="Sync.php" role="php" />
- <file name="Importer.php" role="php" />
- <file name="Streamer.php" role="php" />
</dir> <!-- /lib/Horde/ActiveSync -->
<file name="ActiveSync.php" role="php" />
</dir> <!-- /lib/Horde -->
</dependencies>
<phprelease>
<filelist>
+ <install name="lib/Horde/ActiveSync/Connector/Exporter.php" as="Horde/ActiveSync/Connector/Exporter.php" />
+ <install name="lib/Horde/ActiveSync/Connector/Importer.php" as="Horde/ActiveSync/Connector/Importer.php" />
+ <install name="lib/Horde/ActiveSync/Connector/NullImporter.php" as="Horde/ActiveSync/Connector/NullImporter.php" />
<install name="lib/Horde/ActiveSync/State/Base.php" as="Horde/ActiveSync/State/Base.php" />
<install name="lib/Horde/ActiveSync/State/File.php" as="Horde/ActiveSync/State/File.php" />
<install name="lib/Horde/ActiveSync/Driver/Horde/Connector/Registry.php" as="Horde/ActiveSync/Driver/Horde/Connector/Registry.php" />
<install name="lib/Horde/ActiveSync/Request/Options.php" as="Horde/ActiveSync/Request/Options.php" />
<install name="lib/Horde/ActiveSync/Request/Provision.php" as="Horde/ActiveSync/Request/Provision.php" />
<install name="lib/Horde/ActiveSync/Request/GetItemEstimate.php" as="Horde/ActiveSync/Request/GetItemEstimate.php" />
- <install name="lib/Horde/ActiveSync/ContentsCache.php" as="Horde/ActiveSync/ContentsCache.php" />
<install name="lib/Horde/ActiveSync/Exception.php" as="Horde/ActiveSync/Exception.php" />
- <install name="lib/Horde/ActiveSync/HierarchyCache.php" as="Horde/ActiveSync/HierarchyCache.php" />
- <install name="lib/Horde/ActiveSync/ImportContentsChangesStream.php" as="Horde/ActiveSync/ImportContentsChangesStream.php" />
<install name="lib/Horde/ActiveSync/Wbxml.php" as="Horde/ActiveSync/Wbxml.php" />
<install name="lib/Horde/ActiveSync/Timezone.php" as="Horde/ActiveSync/Timezone.php" />
- <install name="lib/Horde/ActiveSync/Importer.php" as="Horde/ActiveSync/Importer.php" />
- <install name="lib/Horde/ActiveSync/Sync.php" as="Horde/ActiveSync/Exporter.php" />
- <install name="lib/Horde/ActiveSync/Streamer.php" as="Horde/ActiveSync/Streamer.php" />
+ <install name="lib/Horde/ActiveSync/Sync.php" as="Horde/ActiveSync/Sync.php" />
<install name="lib/Horde/ActiveSync.php" as="Horde/ActiveSync.php" />
</filelist>
</phprelease>
}
/**
* Test ChangeMessage:
+ *
* This tests converting the contact streamer object to a hash suitable for
* passing to the contacts/import method. Because it only returns the UID
* for the newly added/edited entry, we can't check the results here. The