64 if (!account || !c_message_cache_dir || !bcache)
67 struct stat st = { 0 };
68 if (!((stat(c_message_cache_dir, &st) == 0) && S_ISDIR(st.st_mode)))
70 mutt_error(
_(
"Cache disabled, $message_cache_dir isn't a directory: %s"), c_message_cache_dir);
74 struct Url url = { 0 };
97 if (*(dst->
dptr - 1) !=
'/')
119 if (!bcache || !
id || (*
id ==
'\0') || !newid || (*newid ==
'\0'))
187 if (!
id || (*
id ==
'\0') || !bcache)
214 if (!
id || (*
id ==
'\0') || !bcache)
220 struct stat st = { 0 };
221 if (stat(bcache->
path, &st) == 0)
223 if (!S_ISDIR(st.st_mode))
271 if (!
id || (*
id ==
'\0') || !bcache)
294 if (!
id || (*
id ==
'\0') || !bcache)
302 struct stat st = { 0 };
306 rc = (S_ISREG(st.st_mode) && (st.st_size != 0)) ? 0 : -1;
309 (rc == 0) ?
"yes" :
"no");
337 struct dirent *de = NULL;
347 while ((de = readdir(dir)))
356 if (want_id && (want_id(de->d_name, bcache, data) != 0))
365 if (closedir(dir) < 0)
int(* bcache_list_t)(const char *id, struct BodyCache *bcache, void *data)
int mutt_bcache_exists(struct BodyCache *bcache, const char *id)
Check if a file exists in the Body Cache.
int mutt_bcache_commit(struct BodyCache *bcache, const char *id)
Move a temporary file into the Body Cache.
struct BodyCache * mutt_bcache_open(struct ConnAccount *account, const char *mailbox)
Open an Email-Body Cache.
static int bcache_path(struct ConnAccount *account, const char *mailbox, struct BodyCache *bcache)
Create the cache path for a given account/mailbox.
int mutt_bcache_list(struct BodyCache *bcache, bcache_list_t want_id, void *data)
Find matching entries in the Body Cache.
FILE * mutt_bcache_get(struct BodyCache *bcache, const char *id)
Open a file in the Body Cache.
void mutt_bcache_close(struct BodyCache **ptr)
Close an Email-Body Cache.
int mutt_bcache_del(struct BodyCache *bcache, const char *id)
Delete a file from the Body Cache.
FILE * mutt_bcache_put(struct BodyCache *bcache, const char *id)
Create a file in the Body Cache.
static int mutt_bcache_move(struct BodyCache *bcache, const char *id, const char *newid)
Change the id of a message in the cache.
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
void buf_fix_dptr(struct Buffer *buf)
Move the dptr to end of the Buffer.
size_t buf_addch(struct Buffer *buf, char c)
Add a single character to a Buffer.
size_t buf_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
char * buf_strdup(const struct Buffer *buf)
Copy a Buffer's string.
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
const char * cs_subset_path(const struct ConfigSubset *sub, const char *name)
Get a path config item by name.
Convenience wrapper for the config headers.
Convenience wrapper for the core headers.
Structs that make up an email.
int mutt_file_mkdir(const char *path, mode_t mode)
Recursively create directories.
DIR * mutt_file_opendir(const char *path, enum MuttOpenDirMode mode)
Open a directory.
@ MUTT_OPENDIR_NONE
Plain opendir()
#define mutt_file_fopen(PATH, MODE)
#define mutt_debug(LEVEL,...)
@ LL_DEBUG3
Log at debug level 3.
@ LL_DEBUG1
Log at debug level 1.
#define MUTT_MEM_CALLOC(n, type)
Convenience wrapper for the library headers.
size_t mutt_str_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix.
void account_to_url(struct ConnAccount *cac, struct Url *url)
Fill URL with info from account.
void mutt_encode_path(struct Buffer *buf, const char *src)
Convert a path to 'us-ascii'.
Some miscellaneous functions.
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Local cache of email bodies.
char * path
On-disk path to the file.
String manipulation buffer.
char * dptr
Current read/write position.
size_t dsize
Length of data.
char * data
Pointer to data.
Login details for a remote server.
Container for Accounts, Notifications.
struct ConfigSubset * sub
Inherited config items.
A parsed URL proto://user:password@host:port/path?a=1&b=2
int url_tostring(const struct Url *url, char *dest, size_t len, uint8_t flags)
Output the URL string for a given Url object.