66 if (!account || !c_message_cache_dir || !bcache)
69 struct stat st = { 0 };
70 if (!((stat(c_message_cache_dir, &st) == 0) && S_ISDIR(st.st_mode)))
72 mutt_error(
_(
"Cache disabled, $message_cache_dir isn't a directory: %s"), c_message_cache_dir);
76 struct Url url = { 0 };
99 if (*(dst->
dptr - 1) !=
'/')
121 if (!bcache || !
id || (*
id ==
'\0') || !newid || (*newid ==
'\0'))
189 if (!
id || (*
id ==
'\0') || !bcache)
216 if (!
id || (*
id ==
'\0') || !bcache)
222 struct stat st = { 0 };
223 if (stat(bcache->
path, &st) == 0)
225 if (!S_ISDIR(st.st_mode))
273 if (!
id || (*
id ==
'\0') || !bcache)
296 if (!
id || (*
id ==
'\0') || !bcache)
304 struct stat st = { 0 };
308 rc = (S_ISREG(st.st_mode) && (st.st_size != 0)) ? 0 : -1;
311 (rc == 0) ?
"yes" :
"no");
339 struct dirent *de = NULL;
349 while ((de = readdir(dir)))
358 if (want_id && (want_id(de->d_name, bcache, data) != 0))
367 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.
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
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 mutt_account_tourl(struct ConnAccount *cac, struct Url *url)
Fill URL with info from account.
ConnAccount object used by POP and IMAP.
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.