/**
* Updates the cached MODSEQ value.
*
* @param integer $modseq MODSEQ value to store.
*
* @return mixed The MODSEQ of the old value if it was replaced (or false
* if it didn't exist or is the same).
*/
protected function _updateModSeq($modseq)
{
if (!$this->_initCache(true)) {
return false;
}
$mbox_ob = $this->_mailboxOb();
$uidvalid = $mbox_ob->getStatus(Horde_Imap_Client::STATUS_UIDVALIDITY);
$md = $this->_cache->getMetaData($this->_selected, $uidvalid, array(self::CACHE_MODSEQ));
if (isset($md[self::CACHE_MODSEQ])) {
if ($md[self::CACHE_MODSEQ] < $modseq) {
$set = true;
$sync = $md[self::CACHE_MODSEQ];
} else {
$set = false;
$sync = 0;
}
$mbox_ob->setStatus(Horde_Imap_Client::STATUS_SYNCMODSEQ, $md[self::CACHE_MODSEQ]);
} else {
$set = true;
$sync = 0;
}
/* $modseq can be 0 - NOMODSEQ - so don't store in that case. */
if ($set && $modseq) {
$this->_cache->setMetaData($this->_selected, $uidvalid, array(self::CACHE_MODSEQ => $modseq));
}
return $sync;
}