NeoMutt  2025-01-09-117-gace867
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
mutt_thread.h
Go to the documentation of this file.
1
25#ifndef MUTT_MUTT_THREAD_H
26#define MUTT_MUTT_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
42{
44 struct MuttThread *tree;
45 struct HashTable *hash;
48};
49
56{
71
73};
74
75typedef uint8_t MuttThreadFlags;
76#define MUTT_THREAD_NO_FLAGS 0
77#define MUTT_THREAD_COLLAPSE (1 << 0)
78#define MUTT_THREAD_UNCOLLAPSE (1 << 1)
79#define MUTT_THREAD_UNREAD (1 << 2)
80#define MUTT_THREAD_NEXT_UNREAD (1 << 3)
81#define MUTT_THREAD_FLAGGED (1 << 4)
82
87{
90};
91
96{
101};
102
103extern const struct EnumDef UseThreadsTypeDef;
104
105int mutt_traverse_thread(struct Email *e, MuttThreadFlags flag);
106#define mutt_collapse_thread(e) mutt_traverse_thread(e, MUTT_THREAD_COLLAPSE)
107#define mutt_uncollapse_thread(e) mutt_traverse_thread(e, MUTT_THREAD_UNCOLLAPSE)
108#define mutt_thread_contains_unread(e) mutt_traverse_thread(e, MUTT_THREAD_UNREAD)
109#define mutt_thread_contains_flagged(e) mutt_traverse_thread(e, MUTT_THREAD_FLAGGED)
110#define mutt_thread_next_unread(e) mutt_traverse_thread(e, MUTT_THREAD_NEXT_UNREAD)
111
113#define mutt_using_threads() (mutt_thread_style() > UT_FLAT)
114const char *get_use_threads_str(enum UseThreads value);
115int sort_validator(const struct ConfigDef *cdef, intptr_t value, struct Buffer *err);
116
117int mutt_aside_thread(struct Email *e, bool forwards, bool subthreads);
118#define mutt_next_thread(e) mutt_aside_thread(e, true, false)
119#define mutt_previous_thread(e) mutt_aside_thread(e, false, false)
120#define mutt_next_subthread(e) mutt_aside_thread(e, true, true)
121#define mutt_previous_subthread(e) mutt_aside_thread(e, false, true)
122
124void mutt_thread_ctx_free (struct ThreadsContext **ptr);
126void mutt_thread_collapse (struct ThreadsContext *tctx, bool collapse);
127bool mutt_thread_can_collapse (struct Email *e);
128
129void mutt_clear_threads (struct ThreadsContext *tctx);
130void mutt_draw_tree (struct ThreadsContext *tctx);
131bool mutt_link_threads (struct Email *parent, struct EmailArray *children, struct Mailbox *m);
132struct HashTable * mutt_make_id_hash (struct Mailbox *m);
133int mutt_messages_in_thread(struct Mailbox *m, struct Email *e, enum MessageInThread mit);
134int mutt_parent_message (struct Email *e, bool find_root);
135off_t mutt_set_vnum (struct Mailbox *m);
136void mutt_sort_threads (struct ThreadsContext *tctx, bool init);
137
138#endif /* MUTT_MUTT_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: mutt_thread.c:107
uint8_t MuttThreadFlags
Flags, e.g. MUTT_THREAD_COLLAPSE.
Definition: mutt_thread.h:75
void mutt_clear_threads(struct ThreadsContext *tctx)
Clear the threading of message in a mailbox.
Definition: mutt_thread.c:718
UseThreads
Which threading style is active, $use_threads.
Definition: mutt_thread.h:96
@ UT_FLAT
Unthreaded.
Definition: mutt_thread.h:98
@ UT_UNSET
Not yet set by user, stick to legacy semantics.
Definition: mutt_thread.h:97
@ UT_THREADS
Normal threading (root above subthreads)
Definition: mutt_thread.h:99
@ UT_REVERSE
Reverse threading (subthreads above root)
Definition: mutt_thread.h:100
void mutt_thread_collapse(struct ThreadsContext *tctx, bool collapse)
Toggle collapse.
Definition: mutt_thread.c:1789
struct ThreadsContext * mutt_thread_ctx_init(struct MailboxView *mv)
Initialize a threading context.
Definition: mutt_thread.c:355
void mutt_thread_collapse_collapsed(struct ThreadsContext *tctx)
Re-collapse threads marked as collapsed.
Definition: mutt_thread.c:1768
int mutt_traverse_thread(struct Email *e, MuttThreadFlags flag)
Recurse through an email thread, matching messages.
Definition: mutt_thread.c:1438
bool mutt_link_threads(struct Email *parent, struct EmailArray *children, struct Mailbox *m)
Forcibly link threads together.
Definition: mutt_thread.c:1747
void mutt_draw_tree(struct ThreadsContext *tctx)
Draw a tree of threaded emails.
Definition: mutt_thread.c:392
int mutt_messages_in_thread(struct Mailbox *m, struct Email *e, enum MessageInThread mit)
Count the messages in a thread.
Definition: mutt_thread.c:1657
MessageInThread
Flags for mutt_messages_in_thread()
Definition: mutt_thread.h:87
@ MIT_NUM_MESSAGES
How many messages are in the thread.
Definition: mutt_thread.h:88
@ MIT_POSITION
Our position in the thread.
Definition: mutt_thread.h:89
void mutt_thread_ctx_free(struct ThreadsContext **ptr)
Finalize a threading context.
Definition: mutt_thread.c:366
const char * get_use_threads_str(enum UseThreads value)
Convert UseThreads enum to string.
Definition: mutt_thread.c:99
enum UseThreads mutt_thread_style(void)
Which threading style is active?
Definition: mutt_thread.c:81
void mutt_sort_threads(struct ThreadsContext *tctx, bool init)
Sort email threads.
Definition: mutt_thread.c:1031
const struct EnumDef UseThreadsTypeDef
Data for the $use_threads enumeration.
Definition: mutt_thread.c:66
off_t mutt_set_vnum(struct Mailbox *m)
Set the virtual index number of all the messages in a mailbox.
Definition: mutt_thread.c:1404
int mutt_aside_thread(struct Email *e, bool forwards, bool subthreads)
Find the next/previous (sub)thread.
Definition: mutt_thread.c:1287
bool mutt_thread_can_collapse(struct Email *e)
Check whether a thread can be collapsed.
Definition: mutt_thread.c:1817
int mutt_parent_message(struct Email *e, bool find_root)
Find the parent of a message.
Definition: mutt_thread.c:1354
struct HashTable * mutt_make_id_hash(struct Mailbox *m)
Create a Hash Table for message-ids.
Definition: mutt_thread.c:1702
TreeChar
Tree characters for menus.
Definition: mutt_thread.h:56
@ MUTT_TREE_MAX
Definition: mutt_thread.h:70
@ MUTT_TREE_LLCORNER
Lower left corner.
Definition: mutt_thread.h:57
@ MUTT_TREE_RARROW
Right arrow.
Definition: mutt_thread.h:63
@ MUTT_SPECIAL_INDEX
Colour indicator.
Definition: mutt_thread.h:72
@ MUTT_TREE_ULCORNER
Upper left corner.
Definition: mutt_thread.h:58
@ MUTT_TREE_EQUALS
Equals (for threads)
Definition: mutt_thread.h:66
@ MUTT_TREE_HIDDEN
Ampersand character (for threads)
Definition: mutt_thread.h:65
@ MUTT_TREE_STAR
Star character (for threads)
Definition: mutt_thread.h:64
@ MUTT_TREE_LTEE
Left T-piece.
Definition: mutt_thread.h:59
@ MUTT_TREE_VLINE
Vertical line.
Definition: mutt_thread.h:61
@ MUTT_TREE_MISSING
Question mark.
Definition: mutt_thread.h:69
@ MUTT_TREE_TTEE
Top T-piece.
Definition: mutt_thread.h:67
@ MUTT_TREE_HLINE
Horizontal line.
Definition: mutt_thread.h:60
@ MUTT_TREE_SPACE
Blank space.
Definition: mutt_thread.h:62
@ MUTT_TREE_BTEE
Bottom T-piece.
Definition: mutt_thread.h:68
String manipulation buffer.
Definition: buffer.h:36
Definition: set.h:62
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:79
An Email conversation.
Definition: thread.h:34
The "current" threading state.
Definition: mutt_thread.h:42
struct MailboxView * mailbox_view
Current mailbox.
Definition: mutt_thread.h:43
struct MuttThread * tree
Top of thread tree.
Definition: mutt_thread.h:44
enum EmailSortType c_sort
Last sort method.
Definition: mutt_thread.h:46
struct HashTable * hash
Hash Table: "message-id" -> MuttThread.
Definition: mutt_thread.h:45
enum EmailSortType c_sort_aux
Last sort_aux method.
Definition: mutt_thread.h:47