[horde] Sorting Emails

Mike Poznecki poz_sa at yahoo.com
Mon Feb 13 18:36:12 UTC 2017


I cannot find where in the code it decides to go to the alternate sort.  Since the value I want to sort on is not in the standard IMAP list it should go to an alternate method.  There is a php/Horde/Imap/Client/Socket/ClientSort.php.  I put in some logs in the clientSort(), but it never gets called.  Any help here would be great.

      From: Michael J Rubinsky <mrubinsk at horde.org>
 To: horde at lists.horde.org 
 Sent: Thursday, February 9, 2017 10:03 AM
 Subject: Re: [horde] Sorting Emails
   

Quoting Mike Poznecki <poz_sa at yahoo.com>:

> I want to sort my email by a field that is different than what is  
> allowed.  According to the php website:

PHP's documentation of for PHP's imap extension. This is an  
*extremely* inefficient imap client that is basically a wrapper around  
the old and outdated c-client library. Horde has written it's own imap  
client library that takes advantage of features of modern IMAP servers  
that are more suited for the web-mail use case.

>
> Criteria can be one (and only one) of the following:
>    - SORTDATE - message Date
>    - SORTARRIVAL - arrival date
>    - SORTFROM - mailbox in first From address
>    - SORTSUBJECT - message subject
>    - SORTTO - mailbox in first To address
>    - SORTCC - mailbox in first cc address
>    - SORTSIZE - size of message in octets

See the phpdoc for Horde_Imap_Client_Base::search() for a list of sort  
criteria supported by the IMAP protocol.


> But I would like to sort by a different field.  So my questions are these:
> 1. When the emails are read from the server, are they cached in a  
> place that I can then sort?

Sorting takes place on the IMAP server before the results are  
transmitted to Horde whenever possible. Depending on the sort criteria  
requested, this *may* fallback to client side sorting of the requested  
field if the IMAP server does not support the required extension. See  
Horde_Imap_Client_Socket::_search() and  
Horde_Imap_Client_Socket_ClientSort::.

>  If so, are all emails brought back and cached?  If so, where in the  
> code can I look to find where to start making my changes?
> 2. Is there some other way to implement a sort when calling the IMAP server? 

If your desired sort field is not one of those listed in  
Horde_Imap_Client_Base::search(), then you will have to hack the code,  
adding the necessary logic in all of the places (and possibly more)  
mentioned above.

> 3. Why does Horde pass in "DISPLAYFROM"?  I cannot find anywhere in  
> the IMAP docs that references that.

See answer above. This is one of the supported fields.



> Horde mailing list
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: horde-unsubscribe at lists.horde.org



-- 
mike
The Horde Project
http://www.horde.org
https://www.facebook.com/hordeproject
https://www.twitter.com/hordeproject
-- 
Horde mailing list
Frequently Asked Questions: http://horde.org/faq/
To unsubscribe, mail: horde-unsubscribe at lists.horde.org


   


More information about the horde mailing list