Body Caching (local copies of email bodies) More...
#include <stdio.h>
Go to the source code of this file.
Typedefs | |
typedef int(* | bcache_list_t) (const char *id, struct BodyCache *bcache, void *data) |
Functions | |
void | mutt_bcache_close (struct BodyCache **ptr) |
Close an Email-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. | |
FILE * | mutt_bcache_get (struct BodyCache *bcache, const char *id) |
Open a file 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. | |
struct BodyCache * | mutt_bcache_open (struct ConnAccount *account, const char *mailbox) |
Open an Email-Body Cache. | |
FILE * | mutt_bcache_put (struct BodyCache *bcache, const char *id) |
Create a file in the Body Cache. | |
Body Caching (local copies of email bodies)
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 lib.h.
typedef int(* bcache_list_t) (const char *id, struct BodyCache *bcache, void *data) |
void mutt_bcache_close | ( | struct BodyCache ** | ptr | ) |
int mutt_bcache_commit | ( | struct BodyCache * | bcache, |
const char * | id | ||
) |
Move a temporary file into the Body Cache.
bcache | Body Cache from mutt_bcache_open() |
id | Per-mailbox unique identifier for the message |
0 | Success |
-1 | Failure |
Definition at line 252 of file bcache.c.
int mutt_bcache_del | ( | struct BodyCache * | bcache, |
const char * | id | ||
) |
Delete a file from the Body Cache.
bcache | Body Cache from mutt_bcache_open() |
id | Per-mailbox unique identifier for the message |
0 | Success |
-1 | Failure |
Definition at line 269 of file bcache.c.
int mutt_bcache_exists | ( | struct BodyCache * | bcache, |
const char * | id | ||
) |
Check if a file exists in the Body Cache.
bcache | Body Cache from mutt_bcache_open() |
id | Per-mailbox unique identifier for the message |
0 | Success |
-1 | Failure |
Definition at line 292 of file bcache.c.
FILE * mutt_bcache_get | ( | struct BodyCache * | bcache, |
const char * | id | ||
) |
Open a file in the Body Cache.
bcache | Body Cache from mutt_bcache_open() |
id | Per-mailbox unique identifier for the message |
ptr | Success |
NULL | Failure |
Definition at line 185 of file bcache.c.
int mutt_bcache_list | ( | struct BodyCache * | bcache, |
bcache_list_t | want_id, | ||
void * | data | ||
) |
Find matching entries in the Body Cache.
bcache | Body Cache from mutt_bcache_open() |
want_id | Callback function called for each match |
data | Data to pass to the callback function |
-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 334 of file bcache.c.
struct BodyCache * mutt_bcache_open | ( | struct ConnAccount * | account, |
const char * | mailbox | ||
) |
Open an Email-Body Cache.
account | current mailbox' account (required) |
mailbox | path to the mailbox of the account (optional) |
NULL | Failure |
The driver using it is responsible for ensuring that hierarchies are separated by '/' (if it knows of such a concepts like mailboxes or hierarchies)
Definition at line 146 of file bcache.c.
FILE * mutt_bcache_put | ( | struct BodyCache * | bcache, |
const char * | id | ||
) |
Create a file in the Body Cache.
bcache | Body Cache from mutt_bcache_open() |
id | Per-mailbox unique identifier for the message |
ptr | Success |
NULL | Failure |
The returned FILE* is in a temporary location. Use mutt_bcache_commit to put it into place
Definition at line 212 of file bcache.c.