#include "lib.h"
#include "url.h"
-static int mutt_bcache_move(body_cache_t *bcache, const char *id, const char *newid);
+static int mutt_bcache_move(struct BodyCache *bcache, const char *id, const char *newid);
-struct body_cache
+struct BodyCache
{
char path[_POSIX_PATH_MAX];
size_t pathlen;
return 0;
}
-body_cache_t *mutt_bcache_open(struct Account *account, const char *mailbox)
+struct BodyCache *mutt_bcache_open(struct Account *account, const char *mailbox)
{
- struct body_cache *bcache = NULL;
+ struct BodyCache *bcache = NULL;
if (!account)
goto bail;
- bcache = safe_calloc(1, sizeof(struct body_cache));
+ bcache = safe_calloc(1, sizeof(struct BodyCache));
if (bcache_path(account, mailbox, bcache->path, sizeof(bcache->path)) < 0)
goto bail;
bcache->pathlen = mutt_strlen(bcache->path);
return NULL;
}
-void mutt_bcache_close(body_cache_t **bcache)
+void mutt_bcache_close(struct BodyCache **bcache)
{
if (!bcache || !*bcache)
return;
FREE(bcache);
}
-FILE *mutt_bcache_get(body_cache_t *bcache, const char *id)
+FILE *mutt_bcache_get(struct BodyCache *bcache, const char *id)
{
char path[_POSIX_PATH_MAX];
FILE *fp = NULL;
return fp;
}
-FILE *mutt_bcache_put(body_cache_t *bcache, const char *id, int tmp)
+FILE *mutt_bcache_put(struct BodyCache *bcache, const char *id, int tmp)
{
char path[_POSIX_PATH_MAX];
struct stat sb;
return safe_fopen(path, "w+");
}
-int mutt_bcache_commit(body_cache_t *bcache, const char *id)
+int mutt_bcache_commit(struct BodyCache *bcache, const char *id)
{
char tmpid[_POSIX_PATH_MAX];
return mutt_bcache_move(bcache, tmpid, id);
}
-static int mutt_bcache_move(body_cache_t *bcache, const char *id, const char *newid)
+static int mutt_bcache_move(struct BodyCache *bcache, const char *id, const char *newid)
{
char path[_POSIX_PATH_MAX];
char newpath[_POSIX_PATH_MAX];
return rename(path, newpath);
}
-int mutt_bcache_del(body_cache_t *bcache, const char *id)
+int mutt_bcache_del(struct BodyCache *bcache, const char *id)
{
char path[_POSIX_PATH_MAX];
return unlink(path);
}
-int mutt_bcache_exists(body_cache_t *bcache, const char *id)
+int mutt_bcache_exists(struct BodyCache *bcache, const char *id)
{
char path[_POSIX_PATH_MAX];
struct stat st;
return rc;
}
-int mutt_bcache_list(body_cache_t *bcache,
- int (*want_id)(const char *id, body_cache_t *bcache, void *data),
+int mutt_bcache_list(struct BodyCache *bcache,
+ int (*want_id)(const char *id, struct BodyCache *bcache, void *data),
void *data)
{
DIR *d = NULL;
* support for body cache
*/
-struct body_cache;
-typedef struct body_cache body_cache_t;
+struct BodyCache;
/*
* Parameters:
* mailboxes or hierarchies)
* Returns NULL on failure.
*/
-body_cache_t *mutt_bcache_open(struct Account *account, const char *mailbox);
+struct BodyCache *mutt_bcache_open(struct Account *account, const char *mailbox);
/* free all memory of bcache and finally FREE() it, too */
-void mutt_bcache_close(body_cache_t **bcache);
+void mutt_bcache_close(struct BodyCache **bcache);
/*
* Parameters:
* These return NULL/-1 on failure and FILE pointer/0 on success.
*/
-FILE *mutt_bcache_get(body_cache_t *bcache, const char *id);
+FILE *mutt_bcache_get(struct BodyCache *bcache, const char *id);
/* tmp: the returned FILE* is in a temporary location.
* if set, use mutt_bcache_commit to put it into place */
-FILE *mutt_bcache_put(body_cache_t *bcache, const char *id, int tmp);
-int mutt_bcache_commit(body_cache_t *bcache, const char *id);
-int mutt_bcache_del(body_cache_t *bcache, const char *id);
-int mutt_bcache_exists(body_cache_t *bcache, const char *id);
+FILE *mutt_bcache_put(struct BodyCache *bcache, const char *id, int tmp);
+int mutt_bcache_commit(struct BodyCache *bcache, const char *id);
+int mutt_bcache_del(struct BodyCache *bcache, const char *id);
+int mutt_bcache_exists(struct BodyCache *bcache, const char *id);
/*
* This more or less "examines" the cache and calls a function with
* This returns -1 on failure and the count (>=0) of items processed
* otherwise.
*/
-int mutt_bcache_list(body_cache_t *bcache,
- int (*want_id)(const char *id, body_cache_t *bcache, void *data),
+int mutt_bcache_list(struct BodyCache *bcache,
+ int (*want_id)(const char *id, struct BodyCache *bcache, void *data),
void *data);
#endif /* _MUTT_BCACHE_H */
HASH *uid_hash;
unsigned int uid_validity;
unsigned int uidnext;
- body_cache_t *bcache;
+ struct BodyCache *bcache;
/* all folder flags - system flags AND keywords */
LIST *flags;
}
}
-static body_cache_t *msg_cache_open(IMAP_DATA *idata)
+static struct BodyCache *msg_cache_open(IMAP_DATA *idata)
{
char mailbox[_POSIX_PATH_MAX];
return mutt_bcache_commit(idata->bcache, id);
}
-static int msg_cache_clean_cb(const char *id, body_cache_t *bcache, void *data)
+static int msg_cache_clean_cb(const char *id, struct BodyCache *bcache, void *data)
{
unsigned int uv, uid, n;
IMAP_DATA *idata = data;
#endif
/* Remove bcache file */
-static int nntp_bcache_delete(const char *id, body_cache_t *bcache, void *data)
+static int nntp_bcache_delete(const char *id, struct BodyCache *bcache, void *data)
{
NNTP_DATA *nntp_data = data;
anum_t anum;
NEWSRC_ENTRY *newsrc_ent;
NNTP_SERVER *nserv;
NNTP_ACACHE acache[NNTP_ACACHE_LEN];
- body_cache_t *bcache;
+ struct BodyCache *bcache;
} NNTP_DATA;
typedef struct
return 0;
}
-static int msg_cache_check(const char *id, body_cache_t *bcache, void *data)
+static int msg_cache_check(const char *id, struct BodyCache *bcache, void *data)
{
CONTEXT *ctx = NULL;
POP_DATA *pop_data = NULL;
time_t login_delay; /* minimal login delay capability */
char *auth_list; /* list of auth mechanisms */
char *timestamp;
- body_cache_t *bcache; /* body cache */
+ struct BodyCache *bcache; /* body cache */
char err_msg[POP_CMD_RESPONSE];
POP_CACHE cache[POP_CACHE_LEN];
} POP_DATA;