From: Michael M Slusarz Date: Mon, 30 Nov 2009 02:15:26 +0000 (-0700) Subject: Add support for THREAD=REFS (draft-ietf-morg-inthread-00). X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=26f96280acfa4b3dcc39e0115e7a8f801615973e;p=horde.git Add support for THREAD=REFS (draft-ietf-morg-inthread-00). --- diff --git a/framework/Imap_Client/lib/Horde/Imap/Client.php b/framework/Imap_Client/lib/Horde/Imap/Client.php index 5ed7910f7..4bbbf1491 100644 --- a/framework/Imap_Client/lib/Horde/Imap/Client.php +++ b/framework/Imap_Client/lib/Horde/Imap/Client.php @@ -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; diff --git a/framework/Imap_Client/lib/Horde/Imap/Client/Base.php b/framework/Imap_Client/lib/Horde/Imap/Client/Base.php index a9d504181..920c14ac2 100644 --- a/framework/Imap_Client/lib/Horde/Imap/Client/Base.php +++ b/framework/Imap_Client/lib/Horde/Imap/Client/Base.php @@ -1476,8 +1476,9 @@ abstract class Horde_Imap_Client_Base * @param array $options Additional options: *
      * '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
diff --git a/framework/Imap_Client/lib/Horde/Imap/Client/Socket.php b/framework/Imap_Client/lib/Horde/Imap/Client/Socket.php
index f78c225f2..741324c45 100644
--- a/framework/Imap_Client/lib/Horde/Imap/Client/Socket.php
+++ b/framework/Imap_Client/lib/Horde/Imap/Client/Socket.php
@@ -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);
             }
         }
 
diff --git a/framework/Imap_Client/package.xml b/framework/Imap_Client/package.xml
index 9d1164fc5..bef55da56 100644
--- a/framework/Imap_Client/package.xml
+++ b/framework/Imap_Client/package.xml
@@ -31,7 +31,8 @@ http://pear.php.net/dtd/package-2.0.xsd">
   alpha
  
  LGPL
- * Add support for RFC 5258 (LIST-EXTENDED).
+ * 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.