NeoMutt  2021-02-05-89-gabe350
Teaching an old dog new tricks
DOXYGEN
muttlib.h
Go to the documentation of this file.
1 
24 #ifndef MUTT_MUTTLIB_H
25 #define MUTT_MUTTLIB_H
26 
27 #include <signal.h>
28 #include <stdbool.h>
29 #include <stdint.h>
30 #include <stdio.h>
31 #include "format_flags.h"
32 #include "mutt_attach.h"
33 
34 struct Address;
35 struct Body;
36 struct Buffer;
37 struct ListHead;
38 struct passwd;
39 struct stat;
40 
41 /* These Config Variables are only used in muttlib.c */
42 extern struct Regex *C_GecosMask;
43 
44 void mutt_adv_mktemp(struct Buffer *buf);
45 void mutt_buffer_mktemp_full(struct Buffer *buf, const char *prefix, const char *suffix, const char *src, int line);
46 void mutt_buffer_expand_path(struct Buffer *buf);
47 void mutt_buffer_expand_path_regex(struct Buffer *buf, bool regex);
48 void mutt_buffer_pretty_mailbox(struct Buffer *s);
49 void mutt_buffer_sanitize_filename (struct Buffer *buf, const char *path, short slash);
50 void mutt_buffer_save_path(struct Buffer *dest, const struct Address *a);
51 int mutt_check_overwrite(const char *attname, const char *path, struct Buffer *fname, enum SaveAttach *opt, char **directory);
52 void mutt_encode_path(struct Buffer *buf, const char *src);
53 void mutt_expando_format(char *buf, size_t buflen, size_t col, int cols, const char *src, format_t callback, intptr_t data, MuttFormatFlags flags);
54 char * mutt_expand_path(char *s, size_t slen);
55 char * mutt_expand_path_regex(char *buf, size_t buflen, bool regex);
56 char * mutt_gecos_name(char *dest, size_t destlen, struct passwd *pw);
57 void mutt_get_parent_path(const char *path, char *buf, size_t buflen);
58 int mutt_inbox_cmp(const char *a, const char *b);
59 bool mutt_is_text_part(struct Body *b);
60 const char *mutt_make_version(void);
61 void mutt_mktemp_full(char *s, size_t slen, const char *prefix, const char *suffix, const char *src, int line);
62 bool mutt_needs_mailcap(struct Body *m);
63 FILE * mutt_open_read(const char *path, pid_t *thepid);
64 void mutt_pretty_mailbox(char *buf, size_t buflen);
65 void mutt_safe_path(struct Buffer *dest, const struct Address *a);
66 int mutt_save_confirm(const char *s, struct stat *st);
67 void mutt_save_path(char *d, size_t dsize, const struct Address *a);
68 void mutt_sleep(short s);
69 void mutt_str_pretty_size(char *buf, size_t buflen, size_t num);
70 
71 void add_to_stailq (struct ListHead *head, const char *str);
72 void remove_from_stailq(struct ListHead *head, const char *str);
73 
74 #define mutt_mktemp(buf, buflen) mutt_mktemp_pfx_sfx(buf, buflen, "neomutt", NULL)
75 #define mutt_mktemp_pfx_sfx(buf, buflen, prefix, suffix) mutt_mktemp_full(buf, buflen, prefix, suffix, __FILE__, __LINE__)
76 
77 #define mutt_buffer_mktemp(buf) mutt_buffer_mktemp_pfx_sfx(buf, "neomutt", NULL)
78 #define mutt_buffer_mktemp_pfx_sfx(buf, prefix, suffix) mutt_buffer_mktemp_full(buf, prefix, suffix, __FILE__, __LINE__)
79 
80 #endif /* MUTT_MUTTLIB_H */
mutt_is_text_part
bool mutt_is_text_part(struct Body *b)
Is this part of an email in plain text?
Definition: muttlib.c:433
mutt_needs_mailcap
bool mutt_needs_mailcap(struct Body *m)
Does this type need a mailcap entry do display.
Definition: muttlib.c:405
mutt_expand_path_regex
char * mutt_expand_path_regex(char *buf, size_t buflen, bool regex)
Create the canonical path (with regex char escaping)
Definition: muttlib.c:337
Buffer
String manipulation buffer.
Definition: buffer.h:33
format_flags.h
Body
The body of an email.
Definition: body.h:34
mutt_gecos_name
char * mutt_gecos_name(char *dest, size_t destlen, struct passwd *pw)
Lookup a user's real name in /etc/passwd.
Definition: muttlib.c:362
Regex
Cached regular expression.
Definition: regex3.h:89
mutt_inbox_cmp
int mutt_inbox_cmp(const char *a, const char *b)
do two folders share the same path and one is an inbox
Definition: muttlib.c:1595
mutt_adv_mktemp
void mutt_adv_mktemp(struct Buffer *buf)
Create a temporary file.
Definition: muttlib.c:90
add_to_stailq
void add_to_stailq(struct ListHead *head, const char *str)
Add a string to a list.
Definition: muttlib.c:1704
mutt_open_read
FILE * mutt_open_read(const char *path, pid_t *thepid)
Run a command to read from.
Definition: muttlib.c:1306
mutt_expando_format
void mutt_expando_format(char *buf, size_t buflen, size_t col, int cols, const char *src, format_t callback, intptr_t data, MuttFormatFlags flags)
Expand expandos (x) in a string.
Definition: muttlib.c:774
mutt_buffer_sanitize_filename
void mutt_buffer_sanitize_filename(struct Buffer *buf, const char *path, short slash)
Replace unsafe characters in a filename.
Definition: muttlib.c:1641
SaveAttach
SaveAttach
Options for saving attachments.
Definition: mutt_attach.h:54
remove_from_stailq
void remove_from_stailq(struct ListHead *head, const char *str)
Remove an item, matching a string, from a List.
Definition: muttlib.c:1729
mutt_buffer_expand_path
void mutt_buffer_expand_path(struct Buffer *buf)
Create the canonical path.
Definition: muttlib.c:323
mutt_expand_path
char * mutt_expand_path(char *s, size_t slen)
Create the canonical path.
Definition: muttlib.c:128
mutt_buffer_pretty_mailbox
void mutt_buffer_pretty_mailbox(struct Buffer *s)
Shorten a mailbox path using '~' or '='.
Definition: muttlib.c:599
mutt_sleep
void mutt_sleep(short s)
Sleep for a while.
Definition: muttlib.c:1448
mutt_buffer_save_path
void mutt_buffer_save_path(struct Buffer *dest, const struct Address *a)
Make a safe filename from an email address.
Definition: muttlib.c:728
mutt_get_parent_path
void mutt_get_parent_path(const char *path, char *buf, size_t buflen)
Find the parent of a path (or mailbox)
Definition: muttlib.c:1540
format_t
const typedef char *(* format_t)(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, intptr_t data, MuttFormatFlags flags)
Prototype for a mutt_expando_format() callback function.
Definition: format_flags.h:61
mutt_make_version
const char * mutt_make_version(void)
Generate the NeoMutt version string.
Definition: muttlib.c:1462
mutt_pretty_mailbox
void mutt_pretty_mailbox(char *buf, size_t buflen)
Shorten a mailbox path using '~' or '='.
Definition: muttlib.c:523
mutt_safe_path
void mutt_safe_path(struct Buffer *dest, const struct Address *a)
Make a safe filename from an email address.
Definition: muttlib.c:755
mutt_encode_path
void mutt_encode_path(struct Buffer *buf, const char *src)
Convert a path to 'us-ascii'.
Definition: muttlib.c:1476
mutt_buffer_expand_path_regex
void mutt_buffer_expand_path_regex(struct Buffer *buf, bool regex)
Create the canonical path (with regex char escaping)
Definition: muttlib.c:140
Regex::regex
regex_t * regex
compiled expression
Definition: regex3.h:92
C_GecosMask
struct Regex * C_GecosMask
Config: Regex for parsing GECOS field of /etc/passwd.
Definition: muttlib.c:70
mutt_check_overwrite
int mutt_check_overwrite(const char *attname, const char *path, struct Buffer *fname, enum SaveAttach *opt, char **directory)
Ask the user if overwriting is necessary.
Definition: muttlib.c:621
mutt_mktemp_full
void mutt_mktemp_full(char *s, size_t slen, const char *prefix, const char *suffix, const char *src, int line)
Create a temporary filename.
Definition: muttlib.c:494
mutt_save_confirm
int mutt_save_confirm(const char *s, struct stat *st)
Ask the user to save.
Definition: muttlib.c:1351
mutt_attach.h
mutt_buffer_mktemp_full
void mutt_buffer_mktemp_full(struct Buffer *buf, const char *prefix, const char *suffix, const char *src, int line)
Create a temporary file.
Definition: muttlib.c:467
mutt_save_path
void mutt_save_path(char *d, size_t dsize, const struct Address *a)
Turn an email address into a filename (for saving)
Definition: muttlib.c:706
Address
An email address.
Definition: address.h:34
MuttFormatFlags
uint8_t MuttFormatFlags
Flags for mutt_expando_format(), e.g. MUTT_FORMAT_FORCESUBJ.
Definition: format_flags.h:29
mutt_str_pretty_size
void mutt_str_pretty_size(char *buf, size_t buflen, size_t num)
Display an abbreviated size, like 3.4K.
Definition: muttlib.c:1663