|
static int | bcache_path (struct ConnAccount *account, const char *mailbox, struct BodyCache *bcache) |
| Create the cache path for a given account/mailbox.
|
|
static int | mutt_bcache_move (struct BodyCache *bcache, const char *id, const char *newid) |
| Change the id of a message in the cache.
|
|
struct BodyCache * | mutt_bcache_open (struct ConnAccount *account, const char *mailbox) |
| Open an Email-Body Cache.
|
|
void | mutt_bcache_close (struct BodyCache **ptr) |
| Close an Email-Body Cache.
|
|
FILE * | mutt_bcache_get (struct BodyCache *bcache, const char *id) |
| Open a file in the Body Cache.
|
|
FILE * | mutt_bcache_put (struct BodyCache *bcache, const char *id) |
| Create a file in the Body Cache.
|
|
int | mutt_bcache_commit (struct BodyCache *bcache, const char *id) |
| Move a temporary file into the Body Cache.
|
|
int | mutt_bcache_del (struct BodyCache *bcache, const char *id) |
| Delete a file from the Body Cache.
|
|
int | mutt_bcache_exists (struct BodyCache *bcache, const char *id) |
| Check if a file exists in the Body Cache.
|
|
int | mutt_bcache_list (struct BodyCache *bcache, bcache_list_t want_id, void *data) |
| Find matching entries in the Body Cache.
|
|
Body Caching (local copies of email bodies)
- Authors
- Richard Russon
- Pietro Cerutti
- Copyright
- This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Definition in file bcache.c.
Find matching entries in the Body Cache.
- Parameters
-
bcache | Body Cache from mutt_bcache_open() |
want_id | Callback function called for each match |
data | Data to pass to the callback function |
- Return values
-
-1 | Failure |
>=0 | count of matching items |
This more or less "examines" the cache and calls a function with each id it finds if given.
The optional callback function gets the id of a message, the very same body cache handle mutt_bcache_list() is called with (to, perhaps, perform further operations on the bcache), and a data cookie which is just passed as-is. If the return value of the callback is non-zero, the listing is aborted and continued otherwise. The callback is optional so that this function can be used to count the items in the cache (see below for return value).
Definition at line 336 of file bcache.c.
337{
338 DIR *dir = NULL;
339 struct dirent *de = NULL;
340 int rc = -1;
341
343 goto out;
344
345 rc = 0;
346
348
349 while ((de = readdir(dir)))
350 {
352 {
353 continue;
354 }
355
357
358 if (want_id && (want_id(de->d_name, bcache, data) != 0))
359 goto out;
360
361 rc++;
362 }
363
364out:
365 if (dir)
366 {
367 if (closedir(dir) < 0)
368 rc = -1;
369 }
371 return rc;
372}
DIR * mutt_file_opendir(const char *path, enum MuttOpenDirMode mode)
Open a directory.
@ MUTT_OPENDIR_NONE
Plain opendir()
size_t mutt_str_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix.