[
Cross list reply from users list, here is my original post if
somebody is interested
http://lists.roundcube.net/mail-archive/users/2011-09/0000050.html
]
Hello again,
On Wed, 21 Sep 2011 12:18:31 +0200 A.L.E.C wrote:
> On 21.09.2011 12:08, Miguel Telleria de Esteban wrote:
>
> > OPEN QUESTIONS:
> > Is there a way in roundcube to trace the IMAP traffic?
>
> imap_debug option.
>
> > Although I guess that if I don't have the threading options
> > displayed in folder settings is because roundcube has already
> > parsed the capabilities from the server correctly.
>
> Right.
Ok, I can confirm that my IMAP server does not have the THREAD
capability.
* CAPABILITY IMAP4 IMAP4rev1 AUTH=NTLM AUTH=GSSAPI AUTH=PLAIN UIDPLUS
CHILDREN IDLE NAMESPACE
> > * Figuring out how to recover client-side thread sorting in
> > roundcube as a Fallback when the server does not implement it.
>
> You could try to write the code, but it would be slow.
>
Ok, I am going to give it a try :).
So, if I understand correctly the indications here:
http://lists.roundcube.net/mail-archive/users/2011-08/0000028.html
THE FOLLOWING THINGS APPLY
1. Each time a threading sort is needed, the method:
rcube_imap_generic :: thread() is called.
function thread($mailbox, $algorithm='REFERENCES',
$criteria='', $encoding='US-ASCII')
2. This thread() method must perform the following actions:
1. Invoke the THREAD command on the IMAP server using the
function arguments ordering algorithm, search criteria and
encoding as their directly correspondants in the IMAP THREAD
command (RFC 5256).
2. Treat the response, and parse it returning the following values:
- A "tree"
- A "depthmap" (which is an array)
- A "haschildren" (which is also an array)
3. These (tree, depthmap and haschildren) values are generated from the
IMAP THREAD response by the recursive parseThread() private method.
The IMAP THREAD response is specified in RFC 5256, and here I paste
an illustrative example
Server response:
* THREAD (2)(3 6 (4 23)(44 7 96))
means
-- 2
-- 3
\-- 6
|-- 4
| \-- 23
|
\-- 44
\-- 7
\-- 96
4. RFC 5256 defines two sorting/threading algorithms:
- ORDEREDSUBJECT: Poor man's threading algo based on heuristincs
in the subject content.
- REFERENCES: Uses "References" (preferably) or
"In-Reply-To" (alternatively) header to match
"Message-Id" values and establish parent-->child
relationships.
Besides than the RFC 5256, the references method is also
described here: http://www.jwz.org/doc/threading.html
5. There is an additional sorting/threading algorithm recognised by
roundcube:
- REFS: Slight variation of REFERENCES in which the Subject
field is completely ignored.
- So far it seems to be defined in IETF Drafts, it has not reached
RFC status yet.
http://tools.ietf.org/html/draft-ietf-morg-inthread-01
http://tools.ietf.org/html/draft-gulbrandsen-imap-inthread-03
6. The selected threading algorithm is stored in
$RCMAIL->imap->threading
having as values: "REFS", "REFERENCES", "ORDEREDSUBJECT" or NULL
(to signal no threading support)
7. The Iloha IMAP library (former file /program/lib/imap.inc) from
which rcube_imap_generic.php evolves has the following functions
related to threading:
iil_SortThreadHeaders()
iil_C_FetchThreadHeaders()
iil_C_BuildThreads2()
iil_SortThreads()
iil_IndexThreads()
the thread structure is implemented as:
class iilThreadHeader
{
var $id;
var $sbj;
var $irt;
var $mid;
}
MY PROPOSED APPROACH (see also open questions below)
Inside the rcube_imap_generic::thread() function bypass the
this->execute(THREAD) command and call a function of my own:
client_side_thread_command($mailbox, $criteria, $encoding)
This function should perform the following actions:
* Obtain the message-id (or UID?) of files with the SEARCH criteria
* FETCH the headers REFERENCES, IN-REPLY-TO and MESSAGE-ID of the
searched messages.
* Perform the REFS algorithm on them following RFC 5256 or jmz.org's
article (I hope that this is already done in iil library).
* Return a parenthesised list with the thread ordering similar to the
IMAP THREAD reply so that it can be fed to parseThread(), or
alternatively generate the tree, depthmap and haschildren data
structure directly.
CODING RESOURCES
http://trac.roundcube.net/wiki/Dev_Docs
http://trac.roundcube.net/wiki/Dev_PHPCommons
http://roundcube.net/doc/phpdoc/Mail/rcube_imap.html
http://roundcube.net/doc/phpdoc/Mail/rcube_imap_generic.html
OPEN QUESTIONS:
* Is this thread() function, the only entry point for thread ordering
in roundcube?. If it is true then I guess that paging, sorting, etc
are solved elsewhere.
* Is there a per-mailbox indication for threading?
* Is there a combined search+fetch-headers function in
rcube_imap_generic() or rcube_imap()
* Should I work with UID's or message sequences?
* Should I code based on 0.6-rc base or in a more modern svn checkout?
Any more comments will be welcome. I plan to start the work next week.
Regards,
Miguel
--
(O-O)
---oOO-(_)-OOo-----------------------------------------------------
Miguel TELLERIA DE ESTEBAN http://www.mtelleria.com
Email: miguel at mtelleria.com Tel GSM: +34 650 801098
Tel Fix: +34 942 280174
Miembro de http://www.linuca.org Membre du http://www.bxlug.be
¿Usuario captivo o libre? http://www.obtengalinux.org/windows/
Free or captive user? http://www.getgnulinux.org/windows/
-------------------------------------------------------------------
[signature.asc application/pgp-signature (198 bytes)]
[signature.asc application/pgp-signature (198 bytes)]
--- 8< --- detachments --- 8< ---
The following attachments have been detached and are available for viewing.
http://detached.gigo.com/rc/1Y/KLR7Eub4/signature.asc
Only click these links if you trust the sender, as well as this message.
--- 8< --- detachments --- 8< ---
_______________________________________________
List info: http://lists.roundcube.net/dev/
BT/8f4f07cd