$change['id'] = $id;
// mod is 0 to force a re-synch in the case of server failure. This
// is updated after the change succeeds in the next updateState()
- $change['mod'] = 0;
+ $change['mod'] = 0;
$change['parent'] = $this->_folderId;
$change['flags'] = (isset($message->read)) ? $message->read : 0;
$this->_state->updateState('change', $change, Horde_ActiveSync::CHANGE_ORIGIN_NA);
}
/* Record the state of the message */
- $this->_state->updateState('change', $stat, Horde_ActiveSync::CHANGE_ORIGIN_PIM);
+ $this->_state->updateState('change', $stat, Horde_ActiveSync::CHANGE_ORIGIN_PIM, $this->_backend->getUser());
return $stat['id'];
}
$change['id'] = $id;
$change['mod'] = time();
$change['parent'] = $this->_folderId;
- $this->_state->updateState('delete', $change, Horde_ActiveSync::CHANGE_ORIGIN_PIM, $this->_folderId);
+ $this->_state->updateState('delete', $change, Horde_ActiveSync::CHANGE_ORIGIN_PIM, $this->_backend->getUser());
/* If server wins the conflict, don't import change - it will be
* detected on next sync and sent back to PIM (since we updated the PIM
* @param string $type The type of change (change, delete, flags)
* @param array $change A stat/change hash describing the change
* @param integer $origin Flag to indicate the origin of the change.
+ * @param string $user The current synch user
*
* @return void
*/
- abstract public function updateState($type, $change, $origin = Horde_ActiveSync::CHANGE_ORIGIN_NA);
+ abstract public function updateState($type, $change, $origin = Horde_ActiveSync::CHANGE_ORIGIN_NA, $user = null);
/**
* Save folder data for a specific device. This is needed for BC with older
*
* @return void
*/
- public function updateState($type, $change, $origin = Horde_ActiveSync::CHANGE_ORIGIN_NA)
+ public function updateState($type, $change, $origin = Horde_ActiveSync::CHANGE_ORIGIN_NA, $user = null)
{
if (empty($this->_stateCache)) {
$this->_stateCache = array();
* @param string $type The type of change (change, delete, flags)
* @param array $change A stat/change hash describing the change
* @param integer $origin Flag to indicate the origin of the change.
+ * @param string $user The current sync user, only needed if change
+ * origin is CHANGE_ORIGIN_PIM
*
* @return void
*/
- public function updateState($type, $change, $origin = Horde_ActiveSync::CHANGE_ORIGIN_NA)
+ public function updateState($type, $change, $origin = Horde_ActiveSync::CHANGE_ORIGIN_NA, $user = null)
{
if ($origin == Horde_ActiveSync::CHANGE_ORIGIN_PIM) {
- $sql = 'INSERT INTO ' . $this->_syncMapTable . ' (message_uid, sync_modtime, sync_key, sync_devid, sync_folderid) VALUES (?, ?, ?, ?, ?)';
+ $sql = 'INSERT INTO ' . $this->_syncMapTable . ' (message_uid, sync_modtime, sync_key, sync_devid, sync_folderid, sync_user) VALUES (?, ?, ?, ?, ?, ?)';
try {
- $this->_db->insert($sql, array($change['id'], $change['mod'], $this->_syncKey, $this->_devId, $change['parent']));
+ $this->_db->insert($sql, array($change['id'], $change['mod'], $this->_syncKey, $this->_devId, $change['parent'], $user));
} catch (Horde_Db_Exception $e) {
$this->_logger->err($e->getMessage());
throw new Horde_ActiveSync_Exception($e);