From a986a5d6370e39f96c0bc3e5e45ffcafc7b31256 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Tue, 4 Aug 2009 01:03:17 -0600 Subject: [PATCH] Improve thread sort display on servers that don't support REFERENCES sort --- imp/lib/Mailbox.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/imp/lib/Mailbox.php b/imp/lib/Mailbox.php index 4e2890109..357c91044 100644 --- a/imp/lib/Mailbox.php +++ b/imp/lib/Mailbox.php @@ -663,8 +663,18 @@ class IMP_Mailbox if (is_null($this->_threadob)) { try { $this->_threadob = $GLOBALS['imp_imap']->ob->thread($this->_mailbox); + $ref_errcode = null; } catch (Horde_Imap_Client_Exception $e) { - return new Horde_Imap_Client_Thread(); + $ref_errcode = $e->getCode(); + } + + if ($ref_errcode == Horde_Imap_Client_Exception::NOSUPPORTIMAPEXT) { + try { + $this->_threadob = $GLOBALS['imp_imap']->ob->thread($this->_mailbox, array('criteria' => Horde_Imap_Client::THREAD_ORDEREDSUBJECT)); + } catch (Horde_Imap_Client_Exception $e) { + $GLOBALS['notification']->push(_("Server does not support thread sorting."), 'horde.error'); + return new Horde_Imap_Client_Thread(array(), 'uid'); + } } } -- 2.11.0