camel-folder-thread: Camel Reference Manual

## camel-folder-thread camel-folder-thread |

## Functions

CamelFolderThreadNode * | camel_folder_thread_node_get_next ()
CamelFolderThreadNode * | camel_folder_thread_node_get_parent ()
CamelFolderThreadNode * | camel_folder_thread_node_get_child ()
gpointer | camel_folder_thread_node_get_item ()
void | (*CamelFolderThreadVoidFunc) ()
const gchar * | (*CamelFolderThreadStrFunc) ()
gint64 | (*CamelFolderThreadInt64Func) ()
guint64 | (*CamelFolderThreadUint64Func) ()
const GArray * | (*CamelFolderThreadArrayFunc) ()
CamelFolderThread * | camel_folder_thread_new ()
CamelFolderThread * | camel_folder_thread_new_items ()
CamelFolderThreadNode * | camel_folder_thread_get_tree ()
guint | camel_folder_thread_dump ()

## Types and Values

#define | CAMEL_TYPE_FOLDER_THREAD
| CamelFolderThread
| CamelFolderThreadNode

## Object Hierarchy

        GObject
        ╰── CamelFolderThread

## Description

## Functions

### camel_folder_thread_node_get_next ()

    CamelFolderThreadNode *
    camel_folder_thread_node_get_next (CamelFolderThreadNode *self);

Gets the next node in the tree structure from the `self` .

#### Parameters

self | a CamelFolderThreadNode |

#### Returns

the next node in the tree structure from the `self` , or `NULL`.

[nullable][transfer none]

Since: 3.58

### camel_folder_thread_node_get_parent ()

    CamelFolderThreadNode *
    camel_folder_thread_node_get_parent (CamelFolderThreadNode *self);

Gets the parent node in the tree structure from the `self` .

#### Parameters

self | a CamelFolderThreadNode |

#### Returns

the parent node in the tree structure from the `self` , or `NULL`.

[nullable][transfer none]

Since: 3.58

### camel_folder_thread_node_get_child ()

    CamelFolderThreadNode *
    camel_folder_thread_node_get_child (CamelFolderThreadNode *self);

Gets the first child node in the tree structure from the `self` .

#### Parameters

self | a CamelFolderThreadNode |

#### Returns

the first child node in the tree structure from the `self` , or `NULL`.

[nullable][transfer none]

Since: 3.58

### camel_folder_thread_node_get_item ()

    gpointer
    camel_folder_thread_node_get_item (CamelFolderThreadNode *self);

Gets associated data with the `self` . The actual type of the item depends on the way the `self` was created. For the `camel_folder_thread_new()` it's a CamelMessageInfo, for the `camel_folder_thread_new_items()` it's the member of the used items array.

#### Parameters

self | a CamelFolderThreadNode |

#### Returns

associated data with the `self` .

[nullable][transfer none]

Since: 3.58

### CamelFolderThreadVoidFunc ()

    void
    (*CamelFolderThreadVoidFunc) (gconstpointer item);

### CamelFolderThreadStrFunc ()

    const gchar *
    (*CamelFolderThreadStrFunc) (gconstpointer item);

### CamelFolderThreadInt64Func ()

    gint64
    (*CamelFolderThreadInt64Func) (gconstpointer item);

### CamelFolderThreadUint64Func ()

    guint64
    (*CamelFolderThreadUint64Func) (gconstpointer item);

### CamelFolderThreadArrayFunc ()

    const GArray *
    (*CamelFolderThreadArrayFunc) (gconstpointer item);

### camel_folder_thread_new ()

    CamelFolderThread *
    camel_folder_thread_new (CamelFolder *folder,
                             GPtrArray *uids,
                             CamelFolderThreadFlags flags);

Thread a (subset) of the messages in a folder.

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

#### Parameters

folder | a CamelFolder |
uids | The subset of uid's to thread. If `NULL`, then thread all UID-s in the `folder` . | [element-type utf8][nullable]
flags | bit-or of CamelFolderThreadFlags |

#### Returns

a new CamelFolderThread containing a tree of CamelFolderThreadNode-s which represent the threaded structure of the messages.

[transfer full]

Since: 3.58

### camel_folder_thread_new_items ()

    CamelFolderThread *
    camel_folder_thread_new_items (GPtrArray *items,
                                   CamelFolderThreadFlags flags,
                                   CamelFolderThreadStrFunc get_uid_func,
                                   CamelFolderThreadStrFunc get_subject_func,
                                   CamelFolderThreadUint64Func get_message_id_func,
                                   CamelFolderThreadArrayFunc get_references_func,
                                   CamelFolderThreadInt64Func get_date_sent_func,
                                   CamelFolderThreadInt64Func get_date_received_func,
                                   CamelFolderThreadVoidFunc lock_func,
                                   CamelFolderThreadVoidFunc unlock_func);

Creates a folder tree of the provided `items` , which can be accessed only by the provided functions. The `get_date_sent_func` and the `get_date_received_func` can be `NULL` only when the `flags` does not contain `CAMEL_FOLDER_THREAD_FLAG_SORT`.

The `lock_func` and thed `unlock_func` can be `NULL`, but both at the same time can be set or unset.

The `items` array is referenced and should not be manipulated for the life time of the returned CamelFolderThread.

#### Parameters

items | items to thread. | [transfer none][element-type gpointer]
flags | bit-or of CamelFolderThreadFlags |
get_uid_func | an item get function, to get UID. | [scope forever]
get_subject_func | an item get function, to get subject. | [scope forever]
get_message_id_func | an item get function, to get encoded message ID. | [scope forever]
get_references_func | an item get function, to get references. | [scope forever]
get_date_sent_func | an item get function, to get sent date, or `NULL`. | [scope forever][nullable]
get_date_received_func | an item get function, to get received date, or `NULL`. | [scope forever][nullable]
lock_func | an item get function, to lock for changes, or `NULL`. | [scope forever][nullable]
unlock_func | an item get function, to unlock for changes, or `NULL`. | [scope forever][nullable]

#### Returns

a new CamelFolderThread, containing a tree of CamelFolderThreadNode-s which represent the threaded structure of the `items` .

[transfer full]

Since: 3.58

### camel_folder_thread_get_tree ()

    CamelFolderThreadNode *
    camel_folder_thread_get_tree (CamelFolderThread *self);

Gets the root node of the threaded tree of the items.

#### Parameters

self | a CamelFolderThread |

#### Returns

the root node of the threaded tree.

[transfer none]

Since: 3.58

### camel_folder_thread_dump ()

    guint
    camel_folder_thread_dump (CamelFolderThread *self);

## Types and Values

### CAMEL_TYPE_FOLDER_THREAD

    #define CAMEL_TYPE_FOLDER_THREAD (camel_folder_thread_get_type ())

### CamelFolderThread

    typedef struct _CamelFolderThread CamelFolderThread;

Message threading / conversation grouping.

CamelFolderThread computes conversation threads from a list of messages in a folder, based on the In-Reply-To and References headers as described by Jamie Zawinski's threading algorithm (used by Netscape 3 Mail).

Because threading operates on pre-computed hashes from CamelMessageInfo rather than parsing raw message content, it is very fast.

The result is a tree of CamelFolderThreadNode structures accessible via the `tree` field of the CamelFolderThread object. Each node carries a pointer to its CamelMessageInfo and links to its parent, next sibling, and first child, making it straightforward to build a tree-view model.

An optional subject-based fallback algorithm can be enabled (by passing `thread_subject = TRUE` to `camel_folder_thread_new()`) to find conversation parts when In-Reply-To / References headers are absent, by matching "Re: " prefixes on subject lines.

### CamelFolderThreadNode

    typedef struct _CamelFolderThreadNode CamelFolderThreadNode;