Add support for THREAD=REFS (draft-ietf-morg-inthread-00).
authorMichael M Slusarz <slusarz@curecanti.org>
Mon, 30 Nov 2009 02:15:26 +0000 (19:15 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Mon, 30 Nov 2009 02:22:35 +0000 (19:22 -0700)
framework/Imap_Client/lib/Horde/Imap/Client.php
framework/Imap_Client/lib/Horde/Imap/Client/Base.php
framework/Imap_Client/lib/Horde/Imap/Client/Socket.php
framework/Imap_Client/package.xml

index 5ed7910..4bbbf14 100644 (file)
@@ -122,6 +122,7 @@ class Horde_Imap_Client
     /* Constants for thread() */
     const THREAD_ORDEREDSUBJECT = 1;
     const THREAD_REFERENCES = 2;
+    const THREAD_REFS = 3;
 
     /* Constants for fetch() */
     const FETCH_STRUCTURE = 1;
index a9d5041..920c14a 100644 (file)
@@ -1476,8 +1476,9 @@ abstract class Horde_Imap_Client_Base
      * @param array $options   Additional options:
      * <pre>
      * 'criteria' - (mixed) The following thread criteria are available:
-     *              Horde_Imap_Client::THREAD_ORDEREDSUBJECT, and
-     *              Horde_Imap_Client::THREAD_REFERENCES. Additionally, other
+     *              Horde_Imap_Client::THREAD_ORDEREDSUBJECT,
+     *              Horde_Imap_Client::THREAD_REFERENCES, and
+     *              Horde_Imap_Client::THREAD_REFS. Additionally, other
      *              algorithms can be explicitly specified by passing the IMAP
      *              thread algorithm in as a string.
      * 'search' - (object) The search query (a
index f78c225..741324c 100644 (file)
@@ -36,6 +36,7 @@
  *   RFC 5464 - METADATA
  *
  *   draft-ietf-morg-sortdisplay-02 - SORT=DISPLAY
+ *   draft-ietf-morg-inthread-00 - THREAD=REFS
  *
  *   [NO RFC] - XIMAPPROXY
  *       + Requires imapproxy v1.2.7-rc1 or later
@@ -56,6 +57,8 @@
  *   RFC 5465 - NOTIFY
  *   RFC 5466 - FILTERS
  *
+ *   draft-ietf-morg-inthread-00 - SEARCH=INTHREAD
+ *
  * Originally based on code from:
  *   + auth.php (1.49)
  *   + imap_general.php (1.212)
@@ -2005,7 +2008,8 @@ class Horde_Imap_Client_Socket extends Horde_Imap_Client_Base
     {
         $thread_criteria = array(
             Horde_Imap_Client::THREAD_ORDEREDSUBJECT => 'ORDEREDSUBJECT',
-            Horde_Imap_Client::THREAD_REFERENCES => 'REFERENCES'
+            Horde_Imap_Client::THREAD_REFERENCES => 'REFERENCES',
+            Horde_Imap_Client::THREAD_REFERENCES => 'REFS'
         );
 
         $tsort = (isset($options['criteria']))
@@ -2014,7 +2018,8 @@ class Horde_Imap_Client_Socket extends Horde_Imap_Client_Base
 
         $cap = $this->queryCapability('THREAD');
         if (!$cap || !in_array($tsort, $cap)) {
-            if ($tsort == 'ORDEREDSUBJECT') {
+            switch ($tsort) {
+            case 'ORDEREDSUBJECT':
                 if (empty($options['search'])) {
                     $ids = array();
                 } else {
@@ -2025,8 +2030,10 @@ class Horde_Imap_Client_Socket extends Horde_Imap_Client_Base
                 /* Do client-side ORDEREDSUBJECT threading. */
                 $fetch_res = $this->fetch($this->_selected, array(Horde_Imap_Client::FETCH_ENVELOPE => true, Horde_Imap_Client::FETCH_DATE => true), array('ids' => $ids, 'sequence' => !empty($options['sequence'])));
                 return $this->_clientThreadOrderedsubject($fetch_res);
-            } else {
-                throw new Horde_Imap_Client_Exception('Server does not support REFERENCES thread sort.', Horde_Imap_Client_Exception::NOSUPPORTIMAPEXT);
+
+            case 'REFERENCES':
+            case 'REFS':
+                throw new Horde_Imap_Client_Exception('Server does not support ' . $tsort . ' thread sort.', Horde_Imap_Client_Exception::NOSUPPORTIMAPEXT);
             }
         }
 
index 9d1164f..bef55da 100644 (file)
@@ -31,7 +31,8 @@ http://pear.php.net/dtd/package-2.0.xsd">
   <api>alpha</api>
  </stability>
  <license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license>
- <notes>* Add support for RFC 5258 (LIST-EXTENDED).
+ <notes>* Add support for THREAD=REFS (draft-ietf-morg-inthread-00).
+ * Add support for RFC 5258 (LIST-EXTENDED).
  * Add Horde_Imap_Client_Utils::createUrl().
  * Support SORT=DISPLAY extension.
  * Added search and thread (message list) caching.