From: Timo Sirainen Date: Wed, 31 Aug 2011 08:33:54 +0000 (+0300) Subject: lib-index: Added mail_cache_exists() X-Git-Tag: 2.1.alpha1~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f3976df875193529127d584cb713983e8160bdcf;p=thirdparty%2Fdovecot%2Fcore.git lib-index: Added mail_cache_exists() --- diff --git a/src/lib-index/mail-cache.c b/src/lib-index/mail-cache.c index bca893bddb..79d232f6eb 100644 --- a/src/lib-index/mail-cache.c +++ b/src/lib-index/mail-cache.c @@ -688,6 +688,11 @@ int mail_cache_write(struct mail_cache *cache, const void *data, size_t size, return 0; } +bool mail_cache_exists(struct mail_cache *cache) +{ + return !MAIL_CACHE_IS_UNUSABLE(cache); +} + struct mail_cache_view * mail_cache_view_open(struct mail_cache *cache, struct mail_index_view *iview) { diff --git a/src/lib-index/mail-cache.h b/src/lib-index/mail-cache.h index e9c3f7d9e0..824cf7dd00 100644 --- a/src/lib-index/mail-cache.h +++ b/src/lib-index/mail-cache.h @@ -66,6 +66,8 @@ bool mail_cache_need_compress(struct mail_cache *cache); /* Compress cache file. Offsets are updated to given transaction. */ int mail_cache_compress(struct mail_cache *cache, struct mail_index_transaction *trans); +/* Returns TRUE if there is at least something in the cache. */ +bool mail_cache_exists(struct mail_cache *cache); struct mail_cache_view * mail_cache_view_open(struct mail_cache *cache, struct mail_index_view *iview);