* (i.e. it is selected per default). Otherwise the first entry
* in the list is selected.
*
+ * thread: (string) Set the preferred thread sort algorithm. This algorithm
+ * must be supported by the remote server. By default, IMP attempts
+ * to use REFERENCES sorting and, if this is not available, it will
+ * fall back to ORDEREDSUBJECT sorting done on the local server.
+ *
*
* $Id$
*/
throw new Horde_Auth_Exception($e->getMessage());
}
+ /* Set the IMAP threading algorithm. */
+ $ptr = $GLOBALS['imp_imap']->loadServerConfig($credentials['server']);
+ if (strcasecmp($ptr['protocol'], 'imap') == 0) {
+ $_SESSION['imp']['imap']['thread'] = in_array(isset($ptr['thread']) ? strtoupper($ptr['thread']) : 'REFERENCES', $GLOBALS['imp_imap']->ob()->queryCapability('THREAD'))
+ ? 'REFERENCES'
+ : 'ORDEREDSUBJECT';
+ }
+
return false;
}
{
if (is_null($this->_threadob)) {
try {
- $this->_threadob = $GLOBALS['imp_imap']->ob()->thread($this->_mailbox);
- $ref_errcode = null;
+ $this->_threadob = $GLOBALS['imp_imap']->ob()->thread($this->_mailbox, array('criteria' => $_SESSION['imp']['imap']['thread']));
} catch (Horde_Imap_Client_Exception $e) {
- $error = $e;
- $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');
- }
- } elseif (!is_null($ref_errcode)) {
- $GLOBALS['notification']->push($error, 'horde.error');
+ $GLOBALS['notification']->push($e, 'horde.error');
return new Horde_Imap_Client_Thread(array(), 'uid');
}
}