NeoMutt  2022-04-29-249-gaae397
Teaching an old dog new tricks
DOXYGEN
lib.h
Go to the documentation of this file.
1
37#ifndef MUTT_BROWSER_LIB_H
38#define MUTT_BROWSER_LIB_H
39
40#include "config.h"
41#include <stdbool.h>
42#include <stdint.h>
43#include <sys/types.h>
44#include "mutt/lib.h"
45
46struct Mailbox;
47struct Menu;
48struct MuttWindow;
49struct stat;
50
51extern struct Buffer LastDir;
52extern struct Buffer LastDirBackup;
53
54typedef uint8_t SelectFileFlags;
55#define MUTT_SEL_NO_FLAGS 0
56#define MUTT_SEL_MAILBOX (1 << 0)
57#define MUTT_SEL_MULTI (1 << 1)
58#define MUTT_SEL_FOLDER (1 << 2)
59
63struct Folder
64{
65 struct FolderFile *ff;
66 int num;
67};
68
73{
74 mode_t mode;
75 off_t size;
76 time_t mtime;
77 uid_t uid;
78 gid_t gid;
79 nlink_t nlink;
80
81 char *name;
82 char *desc;
83
87
88#ifdef USE_IMAP
89 char delim;
90
91 bool imap : 1;
92 bool selectable : 1;
93 bool inferiors : 1;
94#endif
95 bool has_mailbox : 1;
96 bool local : 1;
97 bool tagged : 1;
98#ifdef USE_NNTP
99 struct NntpMboxData *nd;
100#endif
101
102 int gen;
103};
104
105ARRAY_HEAD(BrowserStateEntry, struct FolderFile);
106
111{
112 struct BrowserStateEntry entry;
113#ifdef USE_IMAP
115 char *folder;
116#endif
118};
119
120void mutt_select_file(char *file, size_t filelen, SelectFileFlags flags, struct Mailbox *m, char ***files, int *numfiles);
121void mutt_buffer_select_file(struct Buffer *file, SelectFileFlags flags, struct Mailbox *m, char ***files, int *numfiles);
122void mutt_browser_select_dir(const char *f);
123void mutt_browser_cleanup(void);
124
125void browser_sort(struct BrowserState *state);
126void browser_add_folder(const struct Menu *menu, struct BrowserState *state, const char *name, const char *desc, const struct stat *st, struct Mailbox *m, void *data);
127void browser_highlight_default(struct BrowserState *state, struct Menu *menu);
128int examine_directory(struct Mailbox *m, struct Menu *menu, struct BrowserState *state, const char *d, const char *prefix);
129int examine_mailboxes(struct Mailbox *m, struct Menu *menu, struct BrowserState *state);
130void init_menu(struct BrowserState *state, struct Menu *menu, struct Mailbox *m, struct MuttWindow *sbar);
131void init_state(struct BrowserState *state, struct Menu *menu);
132bool link_is_dir(const char *folder, const char *path);
133void destroy_state(struct BrowserState *state);
134void dump_state(struct BrowserState *state);
135
136#endif /* MUTT_BROWSER_LIB_H */
void mutt_select_file(char *file, size_t filelen, SelectFileFlags flags, struct Mailbox *m, char ***files, int *numfiles)
Let the user select a file.
Definition: browser.c:1372
void init_state(struct BrowserState *state, struct Menu *menu)
Initialise a browser state.
Definition: browser.c:532
void init_menu(struct BrowserState *state, struct Menu *menu, struct Mailbox *m, struct MuttWindow *sbar)
Set up a new menu.
Definition: browser.c:874
void browser_sort(struct BrowserState *state)
Sort the entries in the browser.
Definition: sort.c:194
struct Buffer LastDir
Definition: browser.c:136
ARRAY_HEAD(BrowserStateEntry, struct FolderFile)
void mutt_browser_select_dir(const char *f)
Remember the last directory selected.
Definition: browser.c:1068
void destroy_state(struct BrowserState *state)
Free the BrowserState.
Definition: functions.c:74
struct Buffer LastDirBackup
Definition: browser.c:137
void mutt_buffer_select_file(struct Buffer *file, SelectFileFlags flags, struct Mailbox *m, char ***files, int *numfiles)
Let the user select a file.
Definition: browser.c:1088
int examine_directory(struct Mailbox *m, struct Menu *menu, struct BrowserState *state, const char *d, const char *prefix)
Get list of all files/newsgroups with mask.
Definition: browser.c:556
void browser_add_folder(const struct Menu *menu, struct BrowserState *state, const char *name, const char *desc, const struct stat *st, struct Mailbox *m, void *data)
Add a folder to the browser list.
Definition: browser.c:479
void mutt_browser_cleanup(void)
Clean up working Buffers.
Definition: browser.c:158
void browser_highlight_default(struct BrowserState *state, struct Menu *menu)
Decide which browser item should be highlighted.
Definition: browser.c:848
void dump_state(struct BrowserState *state)
int examine_mailboxes(struct Mailbox *m, struct Menu *menu, struct BrowserState *state)
Get list of mailboxes/subscribed newsgroups.
Definition: browser.c:684
uint8_t SelectFileFlags
Flags for mutt_select_file(), e.g. MUTT_SEL_MAILBOX.
Definition: lib.h:54
bool link_is_dir(const char *folder, const char *path)
Does this symlink point to a directory?
Definition: browser.c:171
Convenience wrapper for the library headers.
State of the file/mailbox browser.
Definition: lib.h:111
char * folder
Folder name.
Definition: lib.h:115
bool is_mailbox_list
Viewing mailboxes.
Definition: lib.h:117
struct BrowserStateEntry entry
Array of files / dirs / mailboxes.
Definition: lib.h:112
bool imap_browse
IMAP folder.
Definition: lib.h:114
String manipulation buffer.
Definition: buffer.h:34
Browser entry representing a folder/dir.
Definition: lib.h:73
bool selectable
Folder can be selected.
Definition: lib.h:92
char delim
Path delimiter.
Definition: lib.h:89
bool imap
This is an IMAP folder.
Definition: lib.h:91
bool has_mailbox
This is a mailbox.
Definition: lib.h:95
char * name
Name of file/dir/mailbox.
Definition: lib.h:81
uid_t uid
File's User ID.
Definition: lib.h:77
bool tagged
Folder is tagged.
Definition: lib.h:97
gid_t gid
File's Group ID.
Definition: lib.h:78
bool has_new_mail
true if mailbox has "new mail"
Definition: lib.h:84
nlink_t nlink
Number of hard links.
Definition: lib.h:79
char * desc
Description of mailbox.
Definition: lib.h:82
struct NntpMboxData * nd
Extra NNTP data.
Definition: lib.h:99
off_t size
File size.
Definition: lib.h:75
int gen
Unique id, used for (un)sorting.
Definition: lib.h:102
time_t mtime
Modification time.
Definition: lib.h:76
int msg_count
total number of messages
Definition: lib.h:85
mode_t mode
File permissions.
Definition: lib.h:74
bool inferiors
Folder has children.
Definition: lib.h:93
int msg_unread
number of unread messages
Definition: lib.h:86
A folder/dir in the browser.
Definition: lib.h:64
int num
Number in the index.
Definition: lib.h:66
struct FolderFile * ff
File / Dir / Mailbox.
Definition: lib.h:65
A mailbox.
Definition: mailbox.h:79
Definition: lib.h:69
NNTP-specific Mailbox data -.
Definition: mdata.h:33