NeoMutt  2021-02-05-666-ge300cd
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 void mutt_adv_mktemp(struct Buffer *buf);
42 void mutt_buffer_mktemp_full(struct Buffer *buf, const char *prefix, const char *suffix, const char *src, int line);
43 void mutt_buffer_expand_path(struct Buffer *buf);
44 void mutt_buffer_expand_path_regex(struct Buffer *buf, bool regex);
45 void mutt_buffer_pretty_mailbox(struct Buffer *s);
46 void mutt_buffer_sanitize_filename (struct Buffer *buf, const char *path, short slash);
47 void mutt_buffer_save_path(struct Buffer *dest, const struct Address *a);
48 int mutt_check_overwrite(const char *attname, const char *path, struct Buffer *fname, enum SaveAttach *opt, char **directory);
49 void mutt_encode_path(struct Buffer *buf, const char *src);
50 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);
51 char * mutt_expand_path(char *s, size_t slen);
52 char * mutt_expand_path_regex(char *buf, size_t buflen, bool regex);
53 char * mutt_gecos_name(char *dest, size_t destlen, struct passwd *pw);
54 void mutt_get_parent_path(const char *path, char *buf, size_t buflen);
55 int mutt_inbox_cmp(const char *a, const char *b);
56 bool mutt_is_text_part(struct Body *b);
57 const char *mutt_make_version(void);
58 void mutt_mktemp_full(char *s, size_t slen, const char *prefix, const char *suffix, const char *src, int line);
59 bool mutt_needs_mailcap(struct Body *m);
60 FILE * mutt_open_read(const char *path, pid_t *thepid);
61 void mutt_pretty_mailbox(char *buf, size_t buflen);
62 void mutt_safe_path(struct Buffer *dest, const struct Address *a);
63 int mutt_save_confirm(const char *s, struct stat *st);
64 void mutt_save_path(char *d, size_t dsize, const struct Address *a);
65 void mutt_sleep(short s);
66 void mutt_str_pretty_size(char *buf, size_t buflen, size_t num);
67 
68 void add_to_stailq (struct ListHead *head, const char *str);
69 void remove_from_stailq(struct ListHead *head, const char *str);
70 
71 #define mutt_mktemp(buf, buflen) mutt_mktemp_pfx_sfx(buf, buflen, "neomutt", NULL)
72 #define mutt_mktemp_pfx_sfx(buf, buflen, prefix, suffix) mutt_mktemp_full(buf, buflen, prefix, suffix, __FILE__, __LINE__)
73 
74 #define mutt_buffer_mktemp(buf) mutt_buffer_mktemp_pfx_sfx(buf, "neomutt", NULL)
75 #define mutt_buffer_mktemp_pfx_sfx(buf, prefix, suffix) mutt_buffer_mktemp_full(buf, prefix, suffix, __FILE__, __LINE__)
76 
77 #endif /* MUTT_MUTTLIB_H */
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:780
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:1315
char * mutt_expand_path_regex(char *buf, size_t buflen, bool regex)
Create the canonical path (with regex char escaping)
Definition: muttlib.c:336
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:361
void mutt_buffer_sanitize_filename(struct Buffer *buf, const char *path, short slash)
Replace unsafe characters in a filename.
Definition: muttlib.c:1657
void mutt_str_pretty_size(char *buf, size_t buflen, size_t num)
Display an abbreviated size, like 3.4K.
Definition: muttlib.c:1679
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:1611
String manipulation buffer.
Definition: buffer.h:33
An email address.
Definition: address.h:35
void add_to_stailq(struct ListHead *head, const char *str)
Add a string to a list.
Definition: muttlib.c:1728
Flags to control mutt_expando_format()
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)
Definition: format_flags.h:65
void remove_from_stailq(struct ListHead *head, const char *str)
Remove an item, matching a string, from a List.
Definition: muttlib.c:1753
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:122
void mutt_adv_mktemp(struct Buffer *buf)
Create a temporary file.
Definition: muttlib.c:83
void mutt_buffer_pretty_mailbox(struct Buffer *s)
Shorten a mailbox path using &#39;~&#39; or &#39;=&#39;.
Definition: muttlib.c:603
void mutt_buffer_save_path(struct Buffer *dest, const struct Address *a)
Make a safe filename from an email address.
Definition: muttlib.c:733
void mutt_buffer_expand_path(struct Buffer *buf)
Create the canonical path.
Definition: muttlib.c:322
void mutt_sleep(short s)
Sleep for a while.
Definition: muttlib.c:1461
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:1555
void mutt_safe_path(struct Buffer *dest, const struct Address *a)
Make a safe filename from an email address.
Definition: muttlib.c:761
int mutt_save_confirm(const char *s, struct stat *st)
Ask the user to save.
Definition: muttlib.c:1360
void mutt_buffer_expand_path_regex(struct Buffer *buf, bool regex)
Create the canonical path (with regex char escaping)
Definition: muttlib.c:134
void mutt_encode_path(struct Buffer *buf, const char *src)
Convert a path to &#39;us-ascii&#39;.
Definition: muttlib.c:1490
const char * mutt_make_version(void)
Generate the NeoMutt version string.
Definition: muttlib.c:1476
bool mutt_is_text_part(struct Body *b)
Is this part of an email in plain text?
Definition: muttlib.c:434
void mutt_pretty_mailbox(char *buf, size_t buflen)
Shorten a mailbox path using &#39;~&#39; or &#39;=&#39;.
Definition: muttlib.c:526
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:625
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:468
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:496
SaveAttach
Options for saving attachments.
Definition: mutt_attach.h:55
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:710
bool mutt_needs_mailcap(struct Body *m)
Does this type need a mailcap entry do display.
Definition: muttlib.c:406