NeoMutt  2020-06-26-89-g172cd3
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 */
uint8_t MuttFormatFlags
Flags for mutt_expando_format(), e.g. MUTT_FORMAT_FORCESUBJ.
Definition: format_flags.h:29
FILE * mutt_open_read(const char *path, pid_t *thepid)
Run a command to read from.
Definition: muttlib.c:1304
char * mutt_expand_path_regex(char *buf, size_t buflen, bool regex)
Create the canonical path (with regex char escaping)
Definition: muttlib.c:337
char * mutt_gecos_name(char *dest, size_t destlen, struct passwd *pw)
Lookup a user&#39;s real name in /etc/passwd.
Definition: muttlib.c:362
void mutt_buffer_sanitize_filename(struct Buffer *buf, const char *path, short slash)
Replace unsafe characters in a filename.
Definition: muttlib.c:1637
void mutt_str_pretty_size(char *buf, size_t buflen, size_t num)
Display an abbreviated size, like 3.4K.
Definition: muttlib.c:1659
regex_t * regex
compiled expression
Definition: regex3.h:91
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:1593
String manipulation buffer.
Definition: buffer.h:33
An email address.
Definition: address.h:34
void add_to_stailq(struct ListHead *head, const char *str)
Add a string to a list.
Definition: muttlib.c:1700
Flags to control mutt_expando_format()
void remove_from_stailq(struct ListHead *head, const char *str)
Remove an item, matching a string, from a List.
Definition: muttlib.c:1725
The body of an email.
Definition: body.h:34
char * mutt_expand_path(char *s, size_t slen)
Create the canonical path.
Definition: muttlib.c:128
void mutt_adv_mktemp(struct Buffer *buf)
Create a temporary file.
Definition: muttlib.c:90
void mutt_buffer_pretty_mailbox(struct Buffer *s)
Shorten a mailbox path using &#39;~&#39; or &#39;=&#39;.
Definition: muttlib.c:598
void mutt_buffer_save_path(struct Buffer *dest, const struct Address *a)
Make a safe filename from an email address.
Definition: muttlib.c:726
void mutt_buffer_expand_path(struct Buffer *buf)
Create the canonical path.
Definition: muttlib.c:323
void mutt_sleep(short s)
Sleep for a while.
Definition: muttlib.c:1446
Handling of email attachments.
void mutt_get_parent_path(const char *path, char *buf, size_t buflen)
Find the parent of a path (or mailbox)
Definition: muttlib.c:1538
const 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
void mutt_safe_path(struct Buffer *dest, const struct Address *a)
Make a safe filename from an email address.
Definition: muttlib.c:753
int mutt_save_confirm(const char *s, struct stat *st)
Ask the user to save.
Definition: muttlib.c:1349
void mutt_buffer_expand_path_regex(struct Buffer *buf, bool regex)
Create the canonical path (with regex char escaping)
Definition: muttlib.c:140
void mutt_encode_path(struct Buffer *buf, const char *src)
Convert a path to &#39;us-ascii&#39;.
Definition: muttlib.c:1474
const char * mutt_make_version(void)
Generate the NeoMutt version string.
Definition: muttlib.c:1460
Cached regular expression.
Definition: regex3.h:88
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:772
struct Regex * C_GecosMask
Config: Regex for parsing GECOS field of /etc/passwd.
Definition: muttlib.c:70
int const char int line
Definition: acutest.h:617
bool mutt_is_text_part(struct Body *b)
Is this part of an email in plain text?
Definition: muttlib.c:433
void mutt_pretty_mailbox(char *buf, size_t buflen)
Shorten a mailbox path using &#39;~&#39; or &#39;=&#39;.
Definition: muttlib.c:522
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:620
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
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:493
SaveAttach
Options for saving attachments.
Definition: mutt_attach.h:53
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:704
bool mutt_needs_mailcap(struct Body *m)
Does this type need a mailcap entry do display.
Definition: muttlib.c:405