]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: Added mail_cache_exists()
authorTimo Sirainen <tss@iki.fi>
Wed, 31 Aug 2011 08:33:54 +0000 (11:33 +0300)
committerTimo Sirainen <tss@iki.fi>
Wed, 31 Aug 2011 08:33:54 +0000 (11:33 +0300)
src/lib-index/mail-cache.c
src/lib-index/mail-cache.h

index bca893bddb5e0d9412e88eec69d5fdea90ec82de..79d232f6ebc446df7acdde803358c5fcb6994485 100644 (file)
@@ -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)
 {
index e9c3f7d9e0a68441c1554ba4959088286355c1c2..824cf7dd004eaadb06abe768acb0b238bed546d0 100644 (file)
@@ -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);