From: Michael M Slusarz Date: Thu, 18 Jun 2009 22:54:29 +0000 (-0600) Subject: A bit better error message when mailbox list can not be generated. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=11383e4290304644759bf6d516dd32c7d93e93a9;p=horde.git A bit better error message when mailbox list can not be generated. --- diff --git a/imp/lib/Mailbox.php b/imp/lib/Mailbox.php index 29374dd7c..7017404fe 100644 --- a/imp/lib/Mailbox.php +++ b/imp/lib/Mailbox.php @@ -308,11 +308,15 @@ class IMP_Mailbox $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); @@ -332,6 +336,7 @@ class IMP_Mailbox $this->_sorted = $res['sort']; } catch (Horde_Imap_Client_Exception $e) { $this->_sorted = array(); + $GLOBALS['notification']->push(_("Mailbox listing failed") . ': ' . $e->getMessage(), 'horde.error'); } } } diff --git a/imp/lib/Search.php b/imp/lib/Search.php index 342d86c51..d03dc3dd4 100644 --- a/imp/lib/Search.php +++ b/imp/lib/Search.php @@ -123,6 +123,7 @@ class IMP_Search * current ID set in the object). * * @return array The sorted list. + * @throws Horde_Imap_Client_Exception */ public function runSearch($ob, $id = null) { @@ -148,12 +149,10 @@ class IMP_Search } 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;