public function store($mailbox, array $options = array())
{
// Open mailbox call will handle the login.
$this->openMailbox($mailbox, Horde_Imap_Client::OPEN_READWRITE);
/* SEARCHRES requires server support. */
if (empty($options['ids'])) {
$options['ids'] = $this->getIdsOb(Horde_Imap_Client_Ids::ALL);
} elseif ($options['ids']->isEmpty()) {
return $this->getIdsOb();
} elseif ($options['ids']->search_res && !$this->_capability('SEARCHRES')) {
throw new Horde_Imap_Client_Exception_NoSupportExtension('SEARCHRES');
}
if (!empty($options['unchangedsince'])) {
if (!$this->_capability()->isEnabled('CONDSTORE')) {
throw new Horde_Imap_Client_Exception_NoSupportExtension('CONDSTORE');
}
/* RFC 7162 [3.1.2.2] - trying to do a UNCHANGEDSINCE STORE on a
* mailbox that doesn't support it will return BAD. */
if (!$this->_mailboxOb()->getStatus(Horde_Imap_Client::STATUS_HIGHESTMODSEQ)) {
throw new Horde_Imap_Client_Exception(Horde_Imap_Client_Translation::r("Mailbox does not support mod-sequences."), Horde_Imap_Client_Exception::MBOXNOMODSEQ);
}
}
return $this->_store($options);
}