$query->flag('\\deleted', false);
}
- $this->_sorted = $this->_sortedInfo = array();
- foreach ($GLOBALS['imp_search']->runSearch($query, $this->_mailbox) as $val) {
- list($idx, $mbox) = explode(IMP::IDX_SEP, $val);
- $this->_sorted[] = $idx;
- $this->_sortedInfo[] = array('m' => $mbox);
+ try {
+ foreach ($GLOBALS['imp_search']->runSearch($query, $this->_mailbox) as $val) {
+ list($idx, $mbox) = explode(IMP::IDX_SEP, $val);
+ $this->_sorted[] = $idx;
+ $this->_sortedInfo[] = array('m' => $mbox);
+ }
+ } catch (Horde_Imap_Client_Exception $e) {
+ $this->_sorted = $this->_sortedInfo = array();
+ $GLOBALS['notification']->push(_("Mailbox listing failed") . ': ' . $e->getMessage(), 'horde.error');
}
} else {
$sortpref = IMP::getSort($this->_mailbox);
$this->_sorted = $res['sort'];
} catch (Horde_Imap_Client_Exception $e) {
$this->_sorted = array();
+ $GLOBALS['notification']->push(_("Mailbox listing failed") . ': ' . $e->getMessage(), 'horde.error');
}
}
}
* current ID set in the object).
*
* @return array The sorted list.
+ * @throws Horde_Imap_Client_Exception
*/
public function runSearch($ob, $id = null)
{
}
foreach ($search['folders'] as $val) {
- try {
- $results = $GLOBALS['imp_imap']->ob->search($val, $query, array('reverse' => $sortpref['dir'], 'sort' => array($sortpref['by'])));
- foreach ($results['sort'] as $val2) {
- $sorted[] = $val2 . IMP::IDX_SEP . $val;
- }
- } catch (Horde_Imap_Client_Exception $e) {}
+ $results = $GLOBALS['imp_imap']->ob->search($val, $query, array('reverse' => $sortpref['dir'], 'sort' => array($sortpref['by'])));
+ foreach ($results['sort'] as $val2) {
+ $sorted[] = $val2 . IMP::IDX_SEP . $val;
+ }
}
return $sorted;