/** * Stat a backend item, optionally using the cached value if available. * * @param string $folderid The folder id * @param string $id The message id * @param boolean $hint Use the cached data, if available? * * @return message stat hash */ protected function _smartStatMessage($folderid, $id, $hint) { ob_start(); $this->_logger->info(sprintf("[%s] Horde_Core_ActiveSync_Driver::_smartStatMessage(%s, %s)", $this->_pid, $folderid, $id)); $statKey = $folderid . $id; $mod = false; if ($hint && isset($this->_modCache[$statKey])) { $mod = $this->_modCache[$statKey]; } else { try { // @TODO Horde 6 - combine into single getActionTimestamp method // and pass the folderid. // First, see if we are using a multiplexed id. switch ($folderid) { case self::APPOINTMENTS_FOLDER_UID: $mod = $this->_connector->calendar_getActionTimestamp($id, 'modify'); break; case self::CONTACTS_FOLDER_UID: $mod = $this->_connector->contacts_getActionTimestamp($id, 'modify'); break; case self::TASKS_FOLDER_UID: $mod = $this->_connector->tasks_getActionTimestamp($id, 'modify'); break; case self::NOTES_FOLDER_UID: $mod = $this->_connector->notes_getActionTimestamp($id, 'modify'); break; default: // Not using non-email multiplexed collection. $folder_parts = $this->_parseFolderId($folderid); if (count($folder_parts) == 2) { $folder_class = $folder_parts[self::FOLDER_PART_CLASS]; $serverid = $folder_parts[self::FOLDER_PART_ID]; } else { $folder_class = false; $serverid = null; } switch ($folder_class) { case Horde_ActiveSync::CLASS_CALENDAR: $mod = $this->_connector->calendar_getActionTimestamp($id, 'modify', $serverid); break; case Horde_ActiveSync::CLASS_CONTACTS: $mod = $this->_connector->contacts_getActionTimestamp($id, 'modify', $serverid); break; case Horde_ActiveSync::CLASS_TASKS: $mod = $this->_connector->tasks_getActionTimestamp($id, 'modify', $serverid); break; case Horde_ActiveSync::CLASS_NOTES: $mod = $this->_connector->notes_getActionTimestamp($id, 'modify', $serverid); break; default: try { return $this->statMailMessage($folderid, $id); } catch (Horde_ActiveSync_Exception $e) { $this->_endBuffer(); return false; } } } } catch (Horde_Exception $e) { $this->_logger->err($e->getMessage()); $this->_endBuffer(); return array('id' => '', 'mod' => 0, 'flags' => 1); } $this->_modCache[$statKey] = $mod; } $message = array(); $message['id'] = $id; $message['mod'] = $mod; $message['flags'] = 1; $this->_endBuffer(); return $message; }