NeoMutt  2024-10-02-37-gfa9146
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 <stdbool.h>
29#include <stdint.h>
30#include <sys/types.h>
31#include "config/lib.h"
32
33struct Buffer;
34struct Email;
35struct EmailArray;
36struct Mailbox;
37struct MailboxView;
38
43{
45 struct MuttThread *tree;
46 struct HashTable *hash;
49};
50
57{
72
74};
75
76typedef uint8_t MuttThreadFlags;
77#define MUTT_THREAD_NO_FLAGS 0
78#define MUTT_THREAD_COLLAPSE (1 << 0)
79#define MUTT_THREAD_UNCOLLAPSE (1 << 1)
80#define MUTT_THREAD_UNREAD (1 << 2)
81#define MUTT_THREAD_NEXT_UNREAD (1 << 3)
82#define MUTT_THREAD_FLAGGED (1 << 4)
83
88{
91};
92
97{
102};
103
104extern const struct EnumDef UseThreadsTypeDef;
105
106int mutt_traverse_thread(struct Email *e, MuttThreadFlags flag);
107#define mutt_collapse_thread(e) mutt_traverse_thread(e, MUTT_THREAD_COLLAPSE)
108#define mutt_uncollapse_thread(e) mutt_traverse_thread(e, MUTT_THREAD_UNCOLLAPSE)
109#define mutt_thread_contains_unread(e) mutt_traverse_thread(e, MUTT_THREAD_UNREAD)
110#define mutt_thread_contains_flagged(e) mutt_traverse_thread(e, MUTT_THREAD_FLAGGED)
111#define mutt_thread_next_unread(e) mutt_traverse_thread(e, MUTT_THREAD_NEXT_UNREAD)
112
114#define mutt_using_threads() (mutt_thread_style() > UT_FLAT)
115const char *get_use_threads_str(enum UseThreads value);
116int sort_validator(const struct ConfigSet *cs, const struct ConfigDef *cdef,
117 intptr_t value, struct Buffer *err);
118
119int mutt_aside_thread(struct Email *e, bool forwards, bool subthreads);
120#define mutt_next_thread(e) mutt_aside_thread(e, true, false)
121#define mutt_previous_thread(e) mutt_aside_thread(e, false, false)
122#define mutt_next_subthread(e) mutt_aside_thread(e, true, true)
123#define mutt_previous_subthread(e) mutt_aside_thread(e, false, true)
124
126void mutt_thread_ctx_free (struct ThreadsContext **ptr);
128void mutt_thread_collapse (struct ThreadsContext *tctx, bool collapse);
129bool mutt_thread_can_collapse (struct Email *e);
130
131void mutt_clear_threads (struct ThreadsContext *tctx);
132void mutt_draw_tree (struct ThreadsContext *tctx);
133bool mutt_link_threads (struct Email *parent, struct EmailArray *children, struct Mailbox *m);
134struct HashTable * mutt_make_id_hash (struct Mailbox *m);
135int mutt_messages_in_thread(struct Mailbox *m, struct Email *e, enum MessageInThread mit);
136int mutt_parent_message (struct Email *e, bool find_root);
137off_t mutt_set_vnum (struct Mailbox *m);
138void mutt_sort_threads (struct ThreadsContext *tctx, bool init);
139
140#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 the "sort" config variable - Implements ConfigDef::validator() -.
Definition: mutt_thread.c:108
uint8_t MuttThreadFlags
Flags, e.g. MUTT_THREAD_COLLAPSE.
Definition: mutt_thread.h:76
void mutt_clear_threads(struct ThreadsContext *tctx)
Clear the threading of message in a mailbox.
Definition: mutt_thread.c:720
UseThreads
Which threading style is active, $use_threads.
Definition: mutt_thread.h:97
@ UT_FLAT
Unthreaded.
Definition: mutt_thread.h:99
@ UT_UNSET
Not yet set by user, stick to legacy semantics.
Definition: mutt_thread.h:98
@ UT_THREADS
Normal threading (root above subthreads)
Definition: mutt_thread.h:100
@ UT_REVERSE
Reverse threading (subthreads above root)
Definition: mutt_thread.h:101
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:357
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:394
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:88
@ MIT_NUM_MESSAGES
How many messages are in the thread.
Definition: mutt_thread.h:89
@ MIT_POSITION
Our position in the thread.
Definition: mutt_thread.h:90
void mutt_thread_ctx_free(struct ThreadsContext **ptr)
Finalize a threading context.
Definition: mutt_thread.c:368
const char * get_use_threads_str(enum UseThreads value)
Convert UseThreads enum to string.
Definition: mutt_thread.c:100
enum UseThreads mutt_thread_style(void)
Which threading style is active?
Definition: mutt_thread.c:82
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:67
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:57
@ MUTT_TREE_MAX
Definition: mutt_thread.h:71
@ MUTT_TREE_LLCORNER
Lower left corner.
Definition: mutt_thread.h:58
@ MUTT_TREE_RARROW
Right arrow.
Definition: mutt_thread.h:64
@ MUTT_SPECIAL_INDEX
Colour indicator.
Definition: mutt_thread.h:73
@ MUTT_TREE_ULCORNER
Upper left corner.
Definition: mutt_thread.h:59
@ MUTT_TREE_EQUALS
Equals (for threads)
Definition: mutt_thread.h:67
@ MUTT_TREE_HIDDEN
Ampersand character (for threads)
Definition: mutt_thread.h:66
@ MUTT_TREE_STAR
Star character (for threads)
Definition: mutt_thread.h:65
@ MUTT_TREE_LTEE
Left T-piece.
Definition: mutt_thread.h:60
@ MUTT_TREE_VLINE
Vertical line.
Definition: mutt_thread.h:62
@ MUTT_TREE_MISSING
Question mark.
Definition: mutt_thread.h:70
@ MUTT_TREE_TTEE
Top T-piece.
Definition: mutt_thread.h:68
@ MUTT_TREE_HLINE
Horizontal line.
Definition: mutt_thread.h:61
@ MUTT_TREE_SPACE
Blank space.
Definition: mutt_thread.h:63
@ MUTT_TREE_BTEE
Bottom T-piece.
Definition: mutt_thread.h:69
SortType
Methods for sorting.
Definition: sort2.h:34
String manipulation buffer.
Definition: buffer.h:36
Definition: set.h:64
Container for lots of config items.
Definition: set.h:252
The envelope/body of an email.
Definition: email.h:39
An enumeration.
Definition: enum.h:30
A Hash Table.
Definition: hash.h:97
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:43
struct MailboxView * mailbox_view
Current mailbox.
Definition: mutt_thread.h:44
struct MuttThread * tree
Top of thread tree.
Definition: mutt_thread.h:45
struct HashTable * hash
Hash Table: "message-id" -> MuttThread.
Definition: mutt_thread.h:46
enum SortType c_sort_aux
Last sort_aux method.
Definition: mutt_thread.h:48
enum SortType c_sort
Last sort method.
Definition: mutt_thread.h:47