## camel-folder-thread

camel-folder-thread

## Synopsis

                        CamelFolderThreadNode;
                        CamelFolderThread;
    CamelFolderThread * camel_folder_thread_messages_new    (CamelFolder *folder,
                                                             GPtrArray *uids,
                                                             gboolean thread_subject);
    void                camel_folder_thread_messages_apply  (CamelFolderThread *thread,
                                                             GPtrArray *uids);
    CamelFolderThread * camel_folder_thread_messages_new_summary
                                                            (GPtrArray *summary);
    void                camel_folder_thread_messages_add    (CamelFolderThread *thread,
                                                             GPtrArray *summary);
    void                camel_folder_thread_messages_remove (CamelFolderThread *thread,
                                                             GPtrArray *uids);
    void                camel_folder_thread_messages_ref    (CamelFolderThread *thread);
    void                camel_folder_thread_messages_unref  (CamelFolderThread *thread);
    gint                camel_folder_threaded_messages_dump (CamelFolderThreadNode *c);

## Description

## Details

### CamelFolderThreadNode

    typedef struct {
    	struct _CamelFolderThreadNode *next, *parent, *child;
    	const CamelMessageInfo *message;
    	gchar *root_subject; /* cached root equivalent subject */
    	guint32 order:31;
    	guint32 re:1;			/* re version of subject? */
    } CamelFolderThreadNode;

### CamelFolderThread

    typedef struct {
    	guint32 refcount  : 31;
    	guint32 subject   : 1;

    	struct _CamelFolderThreadNode *tree;
    	struct _EMemChunk *node_chunks;
    	CamelFolder *folder;
    	GPtrArray *summary;
    } CamelFolderThread;

### camel_folder_thread_messages_new ()

    CamelFolderThread * camel_folder_thread_messages_new    (CamelFolder *folder,
                                                             GPtrArray *uids,
                                                             gboolean thread_subject);

Thread a (subset) of the messages in a folder. And sort the result in summary order.

If `thread_subject` is `TRUE`, messages with related subjects will also be threaded. The default behaviour is to only thread based on message-id.

This function is probably to be removed soon.

`uids` : | The subset of uid's to thread. If NULL. then thread all uid's in `folder`.
`thread_subject` : | thread based on subject also
Returns : | A CamelFolderThread contianing a tree of CamelFolderThreadNode's which represent the threaded structure of the messages.

### camel_folder_thread_messages_apply ()

    void                camel_folder_thread_messages_apply  (CamelFolderThread *thread,
                                                             GPtrArray *uids);

`thread` : |
`uids` : |

### camel_folder_thread_messages_new_summary ()

    CamelFolderThread * camel_folder_thread_messages_new_summary
                                                            (GPtrArray *summary);

Thread a list of MessageInfo's. The summary must remain valid for the life of the CamelFolderThread created by this function, and it is upto the caller to ensure this.

`summary` : | Array of CamelMessageInfo's to thread.
Returns : | A CamelFolderThread contianing a tree of CamelFolderThreadNode's which represent the threaded structure of the messages.

### camel_folder_thread_messages_add ()

    void                camel_folder_thread_messages_add    (CamelFolderThread *thread,
                                                             GPtrArray *summary);

`thread` : |
`summary` : |

### camel_folder_thread_messages_remove ()

    void                camel_folder_thread_messages_remove (CamelFolderThread *thread,
                                                             GPtrArray *uids);

`thread` : |
`uids` : |

### camel_folder_thread_messages_ref ()

    void                camel_folder_thread_messages_ref    (CamelFolderThread *thread);

`thread` : |

### camel_folder_thread_messages_unref ()

    void                camel_folder_thread_messages_unref  (CamelFolderThread *thread);

Free all memory associated with the thread descriptor `thread`.

### camel_folder_threaded_messages_dump ()

    gint                camel_folder_threaded_messages_dump (CamelFolderThreadNode *c);

`c` : |
Returns : |