index_mail_update_modseq,
NULL,
index_mail_expunge,
+ index_mail_parse,
index_mail_set_cache_corrupted,
index_mail_opened
};
index_mail_update_modseq,
NULL,
index_mail_expunge,
+ index_mail_parse,
index_mail_set_cache_corrupted,
index_mail_opened
};
index_mail_update_modseq,
NULL,
index_mail_expunge,
+ index_mail_parse,
index_mail_set_cache_corrupted,
index_mail_opened
};
}
}
+void index_mail_parse(struct mail *mail, bool parse_body)
+{
+ struct index_mail *imail = (struct index_mail *)mail;
+
+ imail->data.access_part |= PARSE_HDR;
+ if (index_mail_parse_headers(imail, NULL) == 0) {
+ if (parse_body) {
+ imail->data.access_part |= PARSE_BODY;
+ (void)index_mail_parse_body(imail, 0);
+ }
+ }
+}
+
void index_mail_set_cache_corrupted(struct mail *mail,
enum mail_fetch_field field)
{
struct mail_keywords *keywords);
void index_mail_update_modseq(struct mail *mail, uint64_t min_modseq);
void index_mail_expunge(struct mail *mail);
+void index_mail_parse(struct mail *mail, bool parse_body);
void index_mail_set_cache_corrupted(struct mail *mail,
enum mail_fetch_field field);
int index_mail_opened(struct mail *mail, struct istream **stream);
index_mail_update_modseq,
maildir_update_pop3_uidl,
index_mail_expunge,
+ index_mail_parse,
maildir_mail_set_cache_corrupted,
index_mail_opened
};
index_mail_update_modseq,
NULL,
index_mail_expunge,
+ index_mail_parse,
index_mail_set_cache_corrupted,
index_mail_opened
};
index_mail_update_modseq,
NULL,
index_mail_expunge,
+ index_mail_parse,
index_mail_set_cache_corrupted,
index_mail_opened
};
void (*update_modseq)(struct mail *mail, uint64_t min_modseq);
void (*update_pop3_uidl)(struct mail *mail, const char *uidl);
void (*expunge)(struct mail *mail);
+ void (*parse)(struct mail *mail, bool parse_body);
void (*set_cache_corrupted)(struct mail *mail,
enum mail_fetch_field field);
int (*istream_opened)(struct mail *mail, struct istream **input);
/* Returns TRUE if anything is cached for the mail, FALSE if not. */
bool mail_is_cached(struct mail *mail);
+/* Parse mail's header and optionally body so that fields using them get
+ cached. */
+void mail_parse(struct mail *mail, bool parse_body);
/* Mark a cached field corrupted and have it recalculated. */
void mail_set_cache_corrupted(struct mail *mail, enum mail_fetch_field field);
mail->seq);
}
+void mail_parse(struct mail *mail, bool parse_body)
+{
+ struct mail_private *p = (struct mail_private *)mail;
+
+ p->v.parse(mail, parse_body);
+}
+
void mail_set_cache_corrupted(struct mail *mail, enum mail_fetch_field field)
{
struct mail_private *p = (struct mail_private *)mail;
{
}
+static void test_mail_parse(struct mail *mail ATTR_UNUSED,
+ bool parse_body ATTR_UNUSED)
+{
+}
+
static void
test_mail_set_cache_corrupted(struct mail *mail ATTR_UNUSED,
enum mail_fetch_field field ATTR_UNUSED)
test_mail_update_modseq,
NULL,
test_mail_expunge,
+ test_mail_parse,
test_mail_set_cache_corrupted,
NULL
};
mail_expunge(vmail->backend_mail);
}
+static void virtual_mail_parse(struct mail *mail, bool parse_body)
+{
+ struct virtual_mail *vmail = (struct virtual_mail *)mail;
+
+ if (virtual_mail_handle_lost(vmail) < 0)
+ return;
+ mail_parse(vmail->backend_mail, parse_body);
+}
+
static void
virtual_mail_set_cache_corrupted(struct mail *mail, enum mail_fetch_field field)
{
index_mail_update_modseq,
virtual_mail_update_pop3_uidl,
virtual_mail_expunge,
+ virtual_mail_parse,
virtual_mail_set_cache_corrupted,
NULL
};