NeoMutt  2025-12-11-911-gd8d604
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
thread.h
Go to the documentation of this file.
1
24
25#ifndef MUTT_GUI_THREAD_H
26#define MUTT_GUI_THREAD_H
27
28#include "email/lib.h"
29#include <stdbool.h>
30#include <stdint.h>
31#include <sys/types.h>
32
33struct Buffer;
34struct ConfigDef;
35struct Mailbox;
36struct MailboxView;
37
49
74
87typedef uint8_t MuttThreadFlags;
88
97
108
109extern const struct EnumDef UseThreadsTypeDef;
110
111int mutt_traverse_thread(struct Email *e, MuttThreadFlags flag);
112#define mutt_collapse_thread(e) mutt_traverse_thread(e, MUTT_THREAD_COLLAPSE)
113#define mutt_uncollapse_thread(e) mutt_traverse_thread(e, MUTT_THREAD_UNCOLLAPSE)
114#define mutt_thread_contains_unread(e) mutt_traverse_thread(e, MUTT_THREAD_UNREAD)
115#define mutt_thread_contains_flagged(e) mutt_traverse_thread(e, MUTT_THREAD_FLAGGED)
116#define mutt_thread_next_unread(e) mutt_traverse_thread(e, MUTT_THREAD_NEXT_UNREAD)
117
119#define mutt_using_threads() (mutt_thread_style() > UT_FLAT)
120const char *get_use_threads_str(enum UseThreads value);
121int sort_validator(const struct ConfigDef *cdef, intptr_t value, struct Buffer *err);
122
123int mutt_aside_thread(struct Email *e, bool forwards, bool subthreads);
124#define mutt_next_thread(e) mutt_aside_thread(e, true, false)
125#define mutt_previous_thread(e) mutt_aside_thread(e, false, false)
126#define mutt_next_subthread(e) mutt_aside_thread(e, true, true)
127#define mutt_previous_subthread(e) mutt_aside_thread(e, false, true)
128
130void mutt_thread_ctx_free (struct ThreadsContext **ptr);
132void mutt_thread_collapse (struct ThreadsContext *tctx, bool collapse);
133bool mutt_thread_can_collapse (struct Email *e);
134
135void mutt_clear_threads (struct ThreadsContext *tctx);
136void mutt_draw_tree (struct ThreadsContext *tctx);
137bool mutt_link_threads (struct Email *parent, struct EmailArray *children, struct Mailbox *m);
138struct HashTable * mutt_make_id_hash (struct Mailbox *m);
139int mutt_messages_in_thread(struct Mailbox *m, struct Email *e, enum MessageInThread mit);
140int mutt_parent_message (struct Email *e, bool find_root, int count);
141off_t mutt_set_vnum (struct Mailbox *m);
142void mutt_sort_threads (struct ThreadsContext *tctx, bool init);
143
144#endif /* MUTT_GUI_THREAD_H */
Structs that make up an email.
EmailSortType
Methods for sorting Emails.
Definition sort.h:53
int sort_validator(const struct ConfigDef *cdef, intptr_t value, struct Buffer *err)
Validate the "sort" config variable - Implements ConfigDef::validator() -.
Definition thread.c:105
const struct EnumDef UseThreadsTypeDef
Data for the $use_threads enumeration.
Definition thread.c:64
uint8_t MuttThreadFlags
Definition thread.h:87
void mutt_clear_threads(struct ThreadsContext *tctx)
Clear the threading of message in a mailbox.
Definition thread.c:797
UseThreads
Which threading style is active, $use_threads.
Definition thread.h:102
@ UT_FLAT
Unthreaded.
Definition thread.h:104
@ UT_UNSET
Not yet set by user, stick to legacy semantics.
Definition thread.h:103
@ UT_THREADS
Normal threading (root above subthreads)
Definition thread.h:105
@ UT_REVERSE
Reverse threading (subthreads above root)
Definition thread.h:106
void mutt_thread_collapse(struct ThreadsContext *tctx, bool collapse)
Toggle collapse.
Definition thread.c:1877
struct ThreadsContext * mutt_thread_ctx_init(struct MailboxView *mv)
Initialize a threading context.
Definition thread.c:370
void mutt_thread_collapse_collapsed(struct ThreadsContext *tctx)
Re-collapse threads marked as collapsed.
Definition thread.c:1856
int mutt_parent_message(struct Email *e, bool find_root, int count)
Find the parent of a message.
Definition thread.c:1434
int mutt_traverse_thread(struct Email *e, MuttThreadFlags flag)
Recurse through an email thread, matching messages.
Definition thread.c:1526
bool mutt_link_threads(struct Email *parent, struct EmailArray *children, struct Mailbox *m)
Forcibly link threads together.
Definition thread.c:1835
void mutt_draw_tree(struct ThreadsContext *tctx)
Draw a tree of threaded emails.
Definition thread.c:465
int mutt_messages_in_thread(struct Mailbox *m, struct Email *e, enum MessageInThread mit)
Count the messages in a thread.
Definition thread.c:1745
MessageInThread
Result selectors for mutt_messages_in_thread()
Definition thread.h:93
@ MIT_NUM_MESSAGES
How many messages are in the thread.
Definition thread.h:94
@ MIT_POSITION
Our position in the thread.
Definition thread.h:95
void mutt_thread_ctx_free(struct ThreadsContext **ptr)
Finalize a threading context.
Definition thread.c:381
const char * get_use_threads_str(enum UseThreads value)
Convert UseThreads enum to string.
Definition thread.c:97
enum UseThreads mutt_thread_style(void)
Which threading style is active?
Definition thread.c:79
MuttThreadFlag
Flags, e.g.
Definition thread.h:79
@ MUTT_THREAD_UNCOLLAPSE
Uncollapse an email thread.
Definition thread.h:82
@ MUTT_THREAD_UNREAD
Count unread emails in a thread.
Definition thread.h:83
@ MUTT_THREAD_NONE
No flags are set.
Definition thread.h:80
@ MUTT_THREAD_FLAGGED
Count flagged emails in a thread.
Definition thread.h:85
@ MUTT_THREAD_NEXT_UNREAD
Find the next unread email.
Definition thread.h:84
@ MUTT_THREAD_COLLAPSE
Collapse an email thread.
Definition thread.h:81
void mutt_sort_threads(struct ThreadsContext *tctx, bool init)
Sort email threads.
Definition thread.c:1110
off_t mutt_set_vnum(struct Mailbox *m)
Set the virtual index number of all the messages in a mailbox.
Definition thread.c:1492
int mutt_aside_thread(struct Email *e, bool forwards, bool subthreads)
Find the next/previous (sub)thread.
Definition thread.c:1366
bool mutt_thread_can_collapse(struct Email *e)
Check whether a thread can be collapsed.
Definition thread.c:1905
struct HashTable * mutt_make_id_hash(struct Mailbox *m)
Create a Hash Table for Message-IDs.
Definition thread.c:1790
TreeChar
Tree characters for menus.
Definition thread.h:56
@ MUTT_TREE_MAX
Definition thread.h:70
@ MUTT_TREE_LLCORNER
Lower left corner.
Definition thread.h:57
@ MUTT_TREE_RARROW
Right arrow.
Definition thread.h:63
@ MUTT_SPECIAL_INDEX
Colour indicator.
Definition thread.h:72
@ MUTT_TREE_ULCORNER
Upper left corner.
Definition thread.h:58
@ MUTT_TREE_EQUALS
Equals (for threads)
Definition thread.h:66
@ MUTT_TREE_HIDDEN
Ampersand character (for threads)
Definition thread.h:65
@ MUTT_TREE_STAR
Star character (for threads)
Definition thread.h:64
@ MUTT_TREE_LTEE
Left T-piece.
Definition thread.h:59
@ MUTT_TREE_VLINE
Vertical line.
Definition thread.h:61
@ MUTT_TREE_MISSING
Question mark.
Definition thread.h:69
@ MUTT_TREE_TTEE
Top T-piece.
Definition thread.h:67
@ MUTT_TREE_HLINE
Horizontal line.
Definition thread.h:60
@ MUTT_TREE_SPACE
Blank space.
Definition thread.h:62
@ MUTT_TREE_BTEE
Bottom T-piece.
Definition thread.h:68
String manipulation buffer.
Definition buffer.h:36
The envelope/body of an email.
Definition email.h:39
An enumeration.
Definition enum.h:30
A Hash Table.
Definition hash.h:99
View of a Mailbox.
Definition mview.h:40
A mailbox.
Definition mailbox.h:81
An Email conversation.
Definition thread.h:34
The "current" threading state.
Definition thread.h:42
struct MailboxView * mailbox_view
Current mailbox.
Definition thread.h:43
struct MuttThread * tree
Top of thread tree.
Definition thread.h:44
enum EmailSortType c_sort
Last sort method.
Definition thread.h:46
struct HashTable * hash
Hash Table: "Message-ID" -> MuttThread.
Definition thread.h:45
enum EmailSortType c_sort_aux
Last sort_aux method.
Definition thread.h:47