mutt stable branch with some hacks
at jcs 78 lines 3.1 kB view raw
1/* 2 * Copyright (C) 2006-2007 Brendan Cully <brendan@kublai.com> 3 * Copyright (C) 2006 Rocco Rutte <pdmef@gmx.net> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 */ 19#ifndef _BCACHE_H_ 20#define _BCACHE_H_ 1 21 22/* 23 * support for body cache 24 */ 25 26struct body_cache; 27typedef struct body_cache body_cache_t; 28 29/* 30 * Parameters: 31 * - 'account' is the current mailbox' account (required) 32 * - 'mailbox' is the path to the mailbox of the account (optional): 33 * the driver using it is responsible for ensuring that hierarchies 34 * are separated by '/' (if it knows of such a concepts like 35 * mailboxes or hierarchies) 36 * Returns NULL on failure. 37 */ 38body_cache_t *mutt_bcache_open (ACCOUNT *account, const char *mailbox); 39 40/* free all memory of bcache and finally FREE() it, too */ 41void mutt_bcache_close (body_cache_t **bcache); 42 43/* 44 * Parameters: 45 * - 'bcache' is the pointer returned by mutt_bcache_open() (required) 46 * - 'id' is a per-mailbox unique identifier for the message (required) 47 * These return NULL/-1 on failure and FILE pointer/0 on success. 48 */ 49 50FILE* mutt_bcache_get(body_cache_t *bcache, const char *id); 51/* tmp: the returned FILE* is in a temporary location. 52 * if set, use mutt_bcache_commit to put it into place */ 53FILE* mutt_bcache_put(body_cache_t *bcache, const char *id, int tmp); 54int mutt_bcache_commit(body_cache_t *bcache, const char *id); 55int mutt_bcache_move(body_cache_t *bcache, const char *id, const char *newid); 56int mutt_bcache_del(body_cache_t *bcache, const char *id); 57int mutt_bcache_exists(body_cache_t *bcache, const char *id); 58 59/* 60 * This more or less "examines" the cache and calls a function with 61 * each id it finds if given. 62 * 63 * The optional callback function gets the id of a message, the very same 64 * body cache handle mutt_bcache_list() is called with (to, perhaps, 65 * perform further operations on the bcache), and a data cookie which is 66 * just passed as-is. If the return value of the callback is non-zero, the 67 * listing is aborted and continued otherwise. The callback is optional 68 * so that this function can be used to count the items in the cache 69 * (see below for return value). 70 * 71 * This returns -1 on failure and the count (>=0) of items processed 72 * otherwise. 73 */ 74int mutt_bcache_list(body_cache_t *bcache, 75 int (*want_id)(const char *id, body_cache_t *bcache, 76 void *data), void *data); 77 78#endif /* _BCACHE_H_ */