Skip to content

Commit

Permalink
lib-storage: mail_add_temp_wanted_fields() - delay opening stream
Browse files Browse the repository at this point in the history
Allows plugins to call it in mail.get_stream() without infinite loop.
  • Loading branch information
sirainen authored and GitLab committed Jun 25, 2017
1 parent b5ab297 commit d7c917c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/lib-storage/index/index-mail.c
Expand Up @@ -2009,7 +2009,16 @@ void index_mail_add_temp_wanted_fields(struct mail *_mail,
data->wanted_headers = new_wanted_headers;
}
index_mail_update_access_parts_pre(_mail);
index_mail_update_access_parts_post(_mail);
/* Don't call _post(), which would try to open the stream. It should be
enough to delay the opening until it happens anyway.
Otherwise there's not really any good place to call this in the
plugins: set_seq() call get_stream() internally, which can already
start parsing the headers, so it's too late. If we use get_stream()
and there's a _post() call here, it gets into infinite loop. The
loop could probably be prevented in some way, but it's probably
better to eventually try to remove the _post() call entirely
everywhere. */
}

void index_mail_set_uid_cache_updates(struct mail *_mail, bool set)
Expand Down

0 comments on commit d7c917c

Please sign in to comment.