NeoMutt  2023-03-22
Teaching an old dog new tricks
DOXYGEN
mutt_thread.h
Go to the documentation of this file.
1
23#ifndef MUTT_MUTT_THREAD_H
24#define MUTT_MUTT_THREAD_H
25
26#include <stdbool.h>
27#include <stdint.h>
28#include <sys/types.h>
29#include "config/lib.h"
30
31struct Buffer;
32struct Email;
33struct EmailList;
34struct Mailbox;
35struct ThreadsContext;
36
43{
58
60};
61
62typedef uint8_t MuttThreadFlags;
63#define MUTT_THREAD_NO_FLAGS 0
64#define MUTT_THREAD_COLLAPSE (1 << 0)
65#define MUTT_THREAD_UNCOLLAPSE (1 << 1)
66#define MUTT_THREAD_UNREAD (1 << 2)
67#define MUTT_THREAD_NEXT_UNREAD (1 << 3)
68#define MUTT_THREAD_FLAGGED (1 << 4)
69
74{
77};
78
83{
88};
89
90extern struct EnumDef UseThreadsTypeDef;
91
92int mutt_traverse_thread(struct Email *e, MuttThreadFlags flag);
93#define mutt_collapse_thread(e) mutt_traverse_thread(e, MUTT_THREAD_COLLAPSE)
94#define mutt_uncollapse_thread(e) mutt_traverse_thread(e, MUTT_THREAD_UNCOLLAPSE)
95#define mutt_thread_contains_unread(e) mutt_traverse_thread(e, MUTT_THREAD_UNREAD)
96#define mutt_thread_contains_flagged(e) mutt_traverse_thread(e, MUTT_THREAD_FLAGGED)
97#define mutt_thread_next_unread(e) mutt_traverse_thread(e, MUTT_THREAD_NEXT_UNREAD)
98
100#define mutt_using_threads() (mutt_thread_style() > UT_FLAT)
101const char *get_use_threads_str(enum UseThreads value);
102int sort_validator(const struct ConfigSet *cs, const struct ConfigDef *cdef,
103 intptr_t value, struct Buffer *err);
104
105int mutt_aside_thread(struct Email *e, bool forwards, bool subthreads);
106#define mutt_next_thread(e) mutt_aside_thread(e, true, false)
107#define mutt_previous_thread(e) mutt_aside_thread(e, false, false)
108#define mutt_next_subthread(e) mutt_aside_thread(e, true, true)
109#define mutt_previous_subthread(e) mutt_aside_thread(e, false, true)
110
112void mutt_thread_ctx_free (struct ThreadsContext **tctx);
114void mutt_thread_collapse (struct ThreadsContext *tctx, bool collapse);
115bool mutt_thread_can_collapse (struct Email *e);
116
117void mutt_clear_threads (struct ThreadsContext *tctx);
118void mutt_draw_tree (struct ThreadsContext *tctx);
119bool mutt_link_threads (struct Email *parent, struct EmailList *children, struct Mailbox *m);
120struct HashTable * mutt_make_id_hash (struct Mailbox *m);
121int mutt_messages_in_thread(struct Mailbox *m, struct Email *e, enum MessageInThread mit);
122int mutt_parent_message (struct Email *e, bool find_root);
123off_t mutt_set_vnum (struct Mailbox *m);
124void mutt_sort_threads (struct ThreadsContext *tctx, bool init);
125
126#endif /* MUTT_MUTT_THREAD_H */
Convenience wrapper for the config headers.
int sort_validator(const struct ConfigSet *cs, const struct ConfigDef *cdef, intptr_t value, struct Buffer *err)
Validate values of "sort" - Implements ConfigDef::validator() -.
Definition: mutt_thread.c:115
uint8_t MuttThreadFlags
Flags, e.g. MUTT_THREAD_COLLAPSE.
Definition: mutt_thread.h:62
void mutt_clear_threads(struct ThreadsContext *tctx)
Clear the threading of message in a mailbox.
Definition: mutt_thread.c:708
void mutt_thread_ctx_free(struct ThreadsContext **tctx)
Finalize a threading context.
Definition: mutt_thread.c:365
UseThreads
Which threading style is active, $use_threads.
Definition: mutt_thread.h:83
@ UT_FLAT
Unthreaded.
Definition: mutt_thread.h:85
@ UT_UNSET
Not yet set by user, stick to legacy semantics.
Definition: mutt_thread.h:84
@ UT_THREADS
Normal threading (root above subthreads)
Definition: mutt_thread.h:86
@ UT_REVERSE
Reverse threading (subthreads above root)
Definition: mutt_thread.h:87
void mutt_thread_collapse(struct ThreadsContext *tctx, bool collapse)
Toggle collapse.
Definition: mutt_thread.c:1737
void mutt_thread_collapse_collapsed(struct ThreadsContext *tctx)
Re-collapse threads marked as collapsed.
Definition: mutt_thread.c:1716
int mutt_traverse_thread(struct Email *e, MuttThreadFlags flag)
Recurse through an email thread, matching messages.
Definition: mutt_thread.c:1397
void mutt_draw_tree(struct ThreadsContext *tctx)
Draw a tree of threaded emails.
Definition: mutt_thread.c:384
int mutt_messages_in_thread(struct Mailbox *m, struct Email *e, enum MessageInThread mit)
Count the messages in a thread.
Definition: mutt_thread.c:1608
MessageInThread
Flags for mutt_messages_in_thread()
Definition: mutt_thread.h:74
@ MIT_NUM_MESSAGES
How many messages are in the thread.
Definition: mutt_thread.h:75
@ MIT_POSITION
Our position in the thread.
Definition: mutt_thread.h:76
const char * get_use_threads_str(enum UseThreads value)
Convert UseThreads enum to string.
Definition: mutt_thread.c:107
enum UseThreads mutt_thread_style(void)
Which threading style is active?
Definition: mutt_thread.c:89
bool mutt_link_threads(struct Email *parent, struct EmailList *children, struct Mailbox *m)
Forcibly link threads together.
Definition: mutt_thread.c:1696
void mutt_sort_threads(struct ThreadsContext *tctx, bool init)
Sort email threads.
Definition: mutt_thread.c:1001
struct EnumDef UseThreadsTypeDef
Definition: mutt_thread.c:74
off_t mutt_set_vnum(struct Mailbox *m)
Set the virtual index number of all the messages in a mailbox.
Definition: mutt_thread.c:1363
int mutt_aside_thread(struct Email *e, bool forwards, bool subthreads)
Find the next/previous (sub)thread.
Definition: mutt_thread.c:1249
bool mutt_thread_can_collapse(struct Email *e)
Check whether a thread can be collapsed.
Definition: mutt_thread.c:1765
int mutt_parent_message(struct Email *e, bool find_root)
Find the parent of a message.
Definition: mutt_thread.c:1313
struct HashTable * mutt_make_id_hash(struct Mailbox *m)
Create a Hash Table for message-ids.
Definition: mutt_thread.c:1651
struct ThreadsContext * mutt_thread_ctx_init(struct Mailbox *m)
Initialize a threading context.
Definition: mutt_thread.c:352
TreeChar
Tree characters for menus.
Definition: mutt_thread.h:43
@ MUTT_TREE_MAX
Definition: mutt_thread.h:57
@ MUTT_TREE_LLCORNER
Lower left corner.
Definition: mutt_thread.h:44
@ MUTT_TREE_RARROW
Right arrow.
Definition: mutt_thread.h:50
@ MUTT_SPECIAL_INDEX
Colour indicator.
Definition: mutt_thread.h:59
@ MUTT_TREE_ULCORNER
Upper left corner.
Definition: mutt_thread.h:45
@ MUTT_TREE_EQUALS
Equals (for threads)
Definition: mutt_thread.h:53
@ MUTT_TREE_HIDDEN
Ampersand character (for threads)
Definition: mutt_thread.h:52
@ MUTT_TREE_STAR
Star character (for threads)
Definition: mutt_thread.h:51
@ MUTT_TREE_LTEE
Left T-piece.
Definition: mutt_thread.h:46
@ MUTT_TREE_VLINE
Vertical line.
Definition: mutt_thread.h:48
@ MUTT_TREE_MISSING
Question mark.
Definition: mutt_thread.h:56
@ MUTT_TREE_TTEE
Top T-piece.
Definition: mutt_thread.h:54
@ MUTT_TREE_HLINE
Horizontal line.
Definition: mutt_thread.h:47
@ MUTT_TREE_SPACE
Blank space.
Definition: mutt_thread.h:49
@ MUTT_TREE_BTEE
Bottom T-piece.
Definition: mutt_thread.h:55
String manipulation buffer.
Definition: buffer.h:34
Definition: set.h:64
Container for lots of config items.
Definition: set.h:252
The envelope/body of an email.
Definition: email.h:37
An enumeration.
Definition: enum.h:30
A Hash Table.
Definition: hash.h:96
A mailbox.
Definition: mailbox.h:79
The "current" threading state.
Definition: mutt_thread.c:50