NeoMutt  2021-02-05-666-ge300cd
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 <sys/types.h>
28 #include <stdint.h>
29 
30 struct Email;
31 struct EmailList;
32 struct Mailbox;
33 struct ThreadsContext;
34 
41 {
56 
58 };
59 
60 typedef uint8_t MuttThreadFlags;
61 #define MUTT_THREAD_NO_FLAGS 0
62 #define MUTT_THREAD_COLLAPSE (1 << 0)
63 #define MUTT_THREAD_UNCOLLAPSE (1 << 1)
64 #define MUTT_THREAD_UNREAD (1 << 2)
65 #define MUTT_THREAD_NEXT_UNREAD (1 << 3)
66 #define MUTT_THREAD_FLAGGED (1 << 4)
67 
69 {
70  MIT_NUM_MESSAGES, // How many messages are in the thread
71  MIT_POSITION, // Our position in the thread
72 };
73 
78 {
83 };
84 
85 extern struct EnumDef UseThreadsTypeDef;
86 
87 int mutt_traverse_thread(struct Email *e, MuttThreadFlags flag);
88 #define mutt_collapse_thread(e) mutt_traverse_thread(e, MUTT_THREAD_COLLAPSE)
89 #define mutt_uncollapse_thread(e) mutt_traverse_thread(e, MUTT_THREAD_UNCOLLAPSE)
90 #define mutt_thread_contains_unread(e) mutt_traverse_thread(e, MUTT_THREAD_UNREAD)
91 #define mutt_thread_contains_flagged(e) mutt_traverse_thread(e, MUTT_THREAD_FLAGGED)
92 #define mutt_thread_next_unread(e) mutt_traverse_thread(e, MUTT_THREAD_NEXT_UNREAD)
93 
94 enum UseThreads mutt_thread_style(void);
95 #define mutt_using_threads() (mutt_thread_style() > UT_FLAT)
96 const char *get_use_threads_str(enum UseThreads value);
97 int sort_validator(const struct ConfigSet *cs, const struct ConfigDef *cdef,
98  intptr_t value, struct Buffer *err);
99 
100 int mutt_aside_thread(struct Email *e, bool forwards, bool subthreads);
101 #define mutt_next_thread(e) mutt_aside_thread(e, true, false)
102 #define mutt_previous_thread(e) mutt_aside_thread(e, false, false)
103 #define mutt_next_subthread(e) mutt_aside_thread(e, true, true)
104 #define mutt_previous_subthread(e) mutt_aside_thread(e, false, true)
105 
106 struct ThreadsContext *mutt_thread_ctx_init (struct Mailbox *m);
107 void mutt_thread_ctx_free (struct ThreadsContext **tctx);
109 void mutt_thread_collapse (struct ThreadsContext *tctx, bool collapse);
110 bool mutt_thread_can_collapse (struct Email *e);
111 
112 void mutt_clear_threads (struct ThreadsContext *tctx);
113 void mutt_draw_tree (struct ThreadsContext *tctx);
114 bool mutt_link_threads (struct Email *parent, struct EmailList *children, struct Mailbox *m);
115 struct HashTable * mutt_make_id_hash (struct Mailbox *m);
116 int mutt_messages_in_thread(struct Mailbox *m, struct Email *e, enum MessageInThread mit);
117 int mutt_parent_message (struct Email *e, bool find_root);
118 off_t mutt_set_vnum (struct Mailbox *m);
119 void mutt_sort_threads (struct ThreadsContext *tctx, bool init);
120 
121 #endif /* MUTT_MUTT_THREAD_H */
enum UseThreads mutt_thread_style(void)
Which threading style is active?
Definition: mutt_thread.c:89
An enumeration.
Definition: enum.h:29
Star character (for threads)
Definition: mutt_thread.h:49
Container for lots of config items.
Definition: set.h:259
Ampersand character (for threads)
Definition: mutt_thread.h:50
The envelope/body of an email.
Definition: email.h:37
A Hash Table.
Definition: hash.h:87
struct EnumDef UseThreadsTypeDef
Definition: mutt_thread.c:74
int mutt_aside_thread(struct Email *e, bool forwards, bool subthreads)
Find the next/previous (sub)thread.
Definition: mutt_thread.c:1256
bool mutt_thread_can_collapse(struct Email *e)
Check whether a thread can be collapsed.
Definition: mutt_thread.c:1772
The "current" threading state.
Definition: mutt_thread.c:49
String manipulation buffer.
Definition: buffer.h:33
Normal threading (root above subthreads)
Definition: mutt_thread.h:81
Not yet set by user, stick to legacy semantics.
Definition: mutt_thread.h:79
Definition: set.h:63
off_t mutt_set_vnum(struct Mailbox *m)
Set the virtual index number of all the messages in a mailbox.
Definition: mutt_thread.c:1370
Lower left corner.
Definition: mutt_thread.h:42
int mutt_parent_message(struct Email *e, bool find_root)
Find the parent of a message.
Definition: mutt_thread.c:1320
struct HashTable * mutt_make_id_hash(struct Mailbox *m)
Create a Hash Table for message-ids.
Definition: mutt_thread.c:1658
Top T-piece.
Definition: mutt_thread.h:52
UseThreads
Which threading style is active, $use_threads.
Definition: mutt_thread.h:77
TreeChar
Tree characters for menus.
Definition: mutt_thread.h:40
void mutt_draw_tree(struct ThreadsContext *tctx)
Draw a tree of threaded emails.
Definition: mutt_thread.c:388
Vertical line.
Definition: mutt_thread.h:46
uint8_t MuttThreadFlags
Flags, e.g. MUTT_THREAD_COLLAPSE.
Definition: mutt_thread.h:60
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:116
A mailbox.
Definition: mailbox.h:81
Right arrow.
Definition: mutt_thread.h:48
void mutt_thread_collapse_collapsed(struct ThreadsContext *tctx)
re-collapse threads marked as collapsed
Definition: mutt_thread.c:1723
bool mutt_link_threads(struct Email *parent, struct EmailList *children, struct Mailbox *m)
Forcibly link threads together.
Definition: mutt_thread.c:1703
Bottom T-piece.
Definition: mutt_thread.h:53
Left T-piece.
Definition: mutt_thread.h:44
void mutt_thread_ctx_free(struct ThreadsContext **tctx)
Finalize a threading context.
Definition: mutt_thread.c:369
void mutt_thread_collapse(struct ThreadsContext *tctx, bool collapse)
toggle collapse
Definition: mutt_thread.c:1744
Upper left corner.
Definition: mutt_thread.h:43
const char * get_use_threads_str(enum UseThreads value)
Convert UseThreads enum to string.
Definition: mutt_thread.c:108
Unthreaded.
Definition: mutt_thread.h:80
Horizontal line.
Definition: mutt_thread.h:45
Colour indicator.
Definition: mutt_thread.h:57
void mutt_sort_threads(struct ThreadsContext *tctx, bool init)
Sort email threads.
Definition: mutt_thread.c:1007
void mutt_clear_threads(struct ThreadsContext *tctx)
Clear the threading of message in a mailbox.
Definition: mutt_thread.c:714
int mutt_traverse_thread(struct Email *e, MuttThreadFlags flag)
Recurse through an email thread, matching messages.
Definition: mutt_thread.c:1404
Blank space.
Definition: mutt_thread.h:47
Reverse threading (subthreads above root)
Definition: mutt_thread.h:82
int mutt_messages_in_thread(struct Mailbox *m, struct Email *e, enum MessageInThread mit)
Count the messages in a thread.
Definition: mutt_thread.c:1615
Question mark.
Definition: mutt_thread.h:54
MessageInThread
Definition: mutt_thread.h:68
struct ThreadsContext * mutt_thread_ctx_init(struct Mailbox *m)
Initialize a threading context.
Definition: mutt_thread.c:356
Equals (for threads)
Definition: mutt_thread.h:51