/**
* Get verb changes from the maillog.
*
* @param Horde_ActiveSync_Folder_Imap $folder The folder to search.
* @param integer $ts The timestamp to start from.
*
* @return Horde_ActiveSync_Folder_Imap The folder object, with any changes
* added accordingly.
*/
protected function _getMaillogChanges(Horde_ActiveSync_Folder_Imap $folder, $ts)
{
if ($ts == 0) {
// For initial sync we don't need to poll for these changes since
// when we send the new message, we poll the maillog for last verb
// anyway.
return $folder;
}
$changes = $this->_connector->mail_getMaillogChanges($ts);
$flags = array();
$s_changes = array();
foreach ($changes as $mid) {
try {
$uid = $this->_imap->getUidFromMid($mid, $folder);
} catch (Horde_Exception_NotFound $e) {
continue;
} catch (Horde_ActiveSync_Exception $e) {
$this->_logger->err($e->getMessage());
continue;
}
$s_changes[] = $uid;
$verb = $this->_getLastVerb($mid);
if (!empty($verb)) {
switch ($verb['action']) {
case 'reply':
case 'reply_list':
$flags[$uid] = array(Horde_ActiveSync::CHANGE_REPLY_STATE => $verb['ts']);
break;
case 'reply_all':
$flags[$uid] = array(Horde_ActiveSync::CHANGE_REPLYALL_STATE => $verb['ts']);
break;
case 'forward':
$flags[$uid] = array(Horde_ActiveSync::CHANGE_FORWARD_STATE => $verb['ts']);
}
}
}
if (!empty($s_changes)) {
$folder->setChanges($s_changes, $flags);
}
return $folder;
}