[horde] Sorting Emails

Michael J Rubinsky mrubinsk at horde.org
Wed Feb 15 16:24:47 UTC 2017


Quoting Mike Poznecki <poz_sa at yahoo.com>:

> 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.

I already pointed you to Horde_Imap_Client_Socket::_search. You will  
need to change the logic there to support your new sort-able field.  
Start by looking at the conditional that ensures the requested field  
is present in the $sort_criteria array. This is line 2314 on my local  
copy. Then you'll need to makes sure that clientSort is used further  
down in that method, and of course implement the actual sort logic in  
Horde_Imap_Client_Socket_ClientSort::.


>       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
>
>
>
> --
> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3282 bytes
Desc: S/MIME Signature
URL: <https://lists.horde.org/archives/horde/attachments/20170215/061967c0/attachment.bin>


More information about the horde mailing list