mutt stable branch with some hacks
1/*
2 * Copyright (C) 2004 Thomas Glanzmann <sithglan@stud.uni-erlangen.de>
3 * Copyright (C) 2004 Tobias Werth <sitowert@stud.uni-erlangen.de>
4 * Copyright (C) 2004 Brian Fundakowski Feldman <green@FreeBSD.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 */
20
21#ifndef _HCACHE_H_
22#define _HCACHE_H_ 1
23
24struct header_cache;
25typedef struct header_cache header_cache_t;
26
27typedef int (*hcache_namer_t)(const char* path, char* dest, size_t dlen);
28
29header_cache_t *mutt_hcache_open(const char *path, const char *folder,
30 hcache_namer_t namer);
31void mutt_hcache_close(header_cache_t *h);
32HEADER *mutt_hcache_restore(const unsigned char *d, HEADER **oh);
33void *mutt_hcache_fetch(header_cache_t *h, const char *filename, size_t (*keylen)(const char *fn));
34void *mutt_hcache_fetch_raw (header_cache_t *h, const char *filename,
35 size_t (*keylen)(const char *fn));
36
37typedef enum {
38 MUTT_GENERATE_UIDVALIDITY = 1 /* use gettimeofday() as value */
39} mutt_hcache_store_flags_t;
40
41/* uidvalidity is an IMAP-specific unsigned 32 bit number */
42int mutt_hcache_store(header_cache_t *h, const char *filename, HEADER *header,
43 unsigned int uidvalidity, size_t (*keylen)(const char *fn), mutt_hcache_store_flags_t flags_t);
44int mutt_hcache_store_raw (header_cache_t *h, const char* filename, void* data,
45 size_t dlen, size_t(*keylen) (const char* fn));
46int mutt_hcache_delete(header_cache_t *h, const char *filename, size_t (*keylen)(const char *fn));
47
48const char *mutt_hcache_backend (void);
49
50#endif /* _HCACHE_H_ */