NeoMutt  2018-07-16 +2481-68dcde
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 passwd;
38 struct stat;
39 
40 /* These Config Variables are only used in muttlib.c */
41 extern struct Regex *C_GecosMask;
42 
43 #define MUTT_RANDTAG_LEN 16
44 
45 void mutt_adv_mktemp(struct Buffer *buf);
46 void mutt_buffer_mktemp_full(struct Buffer *buf, const char *prefix, const char *suffix, const char *src, int line);
47 void mutt_buffer_expand_path(struct Buffer *buf);
48 void mutt_buffer_expand_path_regex(struct Buffer *buf, bool regex);
49 void mutt_buffer_pretty_mailbox(struct Buffer *s);
50 void mutt_buffer_sanitize_filename (struct Buffer *buf, const char *path, short slash);
51 int mutt_check_overwrite(const char *attname, const char *path, struct Buffer *fname, enum SaveAttach *opt, char **directory);
52 void mutt_encode_path(char *dest, size_t dlen, const char *src);
53 void mutt_expando_format(char *buf, size_t buflen, size_t col, int cols, const char *src, format_t *callback, unsigned long 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 bool mutt_matches_ignore(const char *s);
62 void mutt_mktemp_full(char *s, size_t slen, const char *prefix, const char *suffix, const char *src, int line);
63 bool mutt_needs_mailcap(struct Body *m);
64 FILE * mutt_open_read(const char *path, pid_t *thepid);
65 void mutt_pretty_mailbox(char *buf, size_t buflen);
66 uint32_t mutt_rand32(void);
67 uint64_t mutt_rand64(void);
68 void mutt_rand_base32(void *out, size_t len);
69 int mutt_randbuf(void *out, size_t len);
70 void mutt_safe_path(char *s, size_t l, const struct Address *a);
71 int mutt_save_confirm(const char *s, struct stat *st);
72 void mutt_save_path(char *d, size_t dsize, const struct Address *a);
73 void mutt_sleep(short s);
74 void mutt_str_pretty_size(char *buf, size_t buflen, size_t num);
75 
76 #define mutt_mktemp(buf, buflen) mutt_mktemp_pfx_sfx(buf, buflen, "neomutt", NULL)
77 #define mutt_mktemp_pfx_sfx(buf, buflen, prefix, suffix) mutt_mktemp_full(buf, buflen, prefix, suffix, __FILE__, __LINE__)
78 
79 #define mutt_buffer_mktemp(buf) mutt_buffer_mktemp_pfx_sfx(buf, "neomutt", NULL)
80 #define mutt_buffer_mktemp_pfx_sfx(buf, prefix, suffix) mutt_buffer_mktemp_full(buf, prefix, suffix, __FILE__, __LINE__)
81 
82 #endif /* MUTT_MUTTLIB_H */
uint8_t MuttFormatFlags
Flags for mutt_expando_format(), e.g. MUTT_FORMAT_FORCESUBJ.
Definition: format_flags.h:29
uint32_t mutt_rand32(void)
Create a 32-bit random number.
Definition: muttlib.c:527
FILE * mutt_open_read(const char *path, pid_t *thepid)
Run a command to read from.
Definition: muttlib.c:1370
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:1705
void mutt_str_pretty_size(char *buf, size_t buflen, size_t num)
Display an abbreviated size, like 3.4K.
Definition: muttlib.c:1727
regex_t * regex
compiled expression
Definition: regex3.h:60
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:1659
String manipulation buffer.
Definition: buffer.h:33
An email address.
Definition: address.h:34
Flags to control mutt_expando_format()
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_safe_path(char *s, size_t l, const struct Address *a)
Make a safe filename from an email address.
Definition: muttlib.c:825
bool mutt_matches_ignore(const char *s)
Does the string match the ignore list.
Definition: parse.c:307
void mutt_buffer_pretty_mailbox(struct Buffer *s)
Shorten a mailbox path using &#39;~&#39; or &#39;=&#39;.
Definition: muttlib.c:688
uint64_t mutt_rand64(void)
Create a 64-bit random number.
Definition: muttlib.c:540
void mutt_buffer_expand_path(struct Buffer *buf)
Create the canonical path.
Definition: muttlib.c:323
const char * line
Definition: common.c:36
void mutt_encode_path(char *dest, size_t dlen, const char *src)
Convert a path into the user&#39;s preferred character set.
Definition: muttlib.c:1538
void mutt_sleep(short s)
Sleep for a while.
Definition: muttlib.c:1509
void mutt_expando_format(char *buf, size_t buflen, size_t col, int cols, const char *src, format_t *callback, unsigned long data, MuttFormatFlags flags)
Expand expandos (x) in a string.
Definition: muttlib.c:844
int mutt_randbuf(void *out, size_t len)
Fill a buffer with randomness.
Definition: muttlib.c:468
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:1604
int mutt_save_confirm(const char *s, struct stat *st)
Ask the user to save.
Definition: muttlib.c:1415
void mutt_buffer_expand_path_regex(struct Buffer *buf, bool regex)
Create the canonical path (with regex char escaping)
Definition: muttlib.c:140
const char * mutt_make_version(void)
Generate the NeoMutt version string.
Definition: muttlib.c:1523
Cached regular expression.
Definition: regex3.h:57
struct Regex * C_GecosMask
Config: Regex for parsing GECOS field of /etc/passwd.
Definition: muttlib.c:70
void mutt_rand_base32(void *out, size_t len)
Fill a buffer with a base32-encoded random string.
Definition: muttlib.c:513
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:612
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, unsigned long data, MuttFormatFlags flags)
typedef format_t - Prototype for a mutt_expando_format() callback function
Definition: format_flags.h:61
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:710
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:557
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:583
SaveAttach
Options for saving attachments.
Definition: mutt_attach.h:52
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:800
bool mutt_needs_mailcap(struct Body *m)
Does this type need a mailcap entry do display.
Definition: muttlib.c:405