changeset 12993:45f6d523b1a1

lib-index: Added mail_cache_field_exists_any()
author Timo Sirainen <tss@iki.fi>
date Thu, 05 May 2011 17:47:58 +0200
parents 23b6234ce0ae
children 55ff92050bd7
files src/lib-index/mail-cache-lookup.c src/lib-index/mail-cache.h
diffstat 2 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-cache-lookup.c	Wed May 04 15:03:14 2011 +0200
+++ b/src/lib-index/mail-cache-lookup.c	Thu May 05 17:47:58 2011 +0200
@@ -328,6 +328,13 @@
 		data[field] == view->cached_exists_value) ? 1 : 0;
 }
 
+bool mail_cache_field_exists_any(struct mail_cache_view *view, uint32_t seq)
+{
+	uint32_t reset_id;
+
+	return mail_cache_lookup_cur_offset(view->view, seq, &reset_id) != 0;
+}
+
 enum mail_cache_decision_type
 mail_cache_field_get_decision(struct mail_cache *cache, unsigned int field_idx)
 {
--- a/src/lib-index/mail-cache.h	Wed May 04 15:03:14 2011 +0200
+++ b/src/lib-index/mail-cache.h	Thu May 05 17:47:58 2011 +0200
@@ -94,9 +94,11 @@
 bool mail_cache_field_can_add(struct mail_cache_transaction_ctx *ctx,
 			      uint32_t seq, unsigned int field_idx);
 
-/* Retursn 1 if field exists, 0 if not, -1 if error. */
+/* Returns 1 if field exists, 0 if not, -1 if error. */
 int mail_cache_field_exists(struct mail_cache_view *view, uint32_t seq,
 			    unsigned int field_idx);
+/* Returns TRUE if something is cached for the message, FALSE if not. */
+bool mail_cache_field_exists_any(struct mail_cache_view *view, uint32_t seq);
 /* Returns current caching decision for given field. */
 enum mail_cache_decision_type
 mail_cache_field_get_decision(struct mail_cache *cache, unsigned int field_idx);