curl-library
RE: Fetching emails via imap without setting the "\Seen" flag (i.e. using BODY.PEEK)
Date: Fri, 15 Mar 2019 12:10:48 +0100
Hello,
> On Fri, 15 Mar 2019, Daniel Stenberg via curl-library wrote:
>
> This is hardly an approach that we can use in curl so while this might fix
Luca's
> current problem, it is not a patch we can merge as-is.
> I would be interested in discussing what we should or could do to support
this
> feature in a more proper and curl-friendly way.
I definitely agree, and I have changed the implementation to be in line with
current imap.c structure of the code.
I have added a new function (imap_perform_custom_fetch_body) that behaves
similarly to existing imap_perform_fetch, with the difference that it sends
the custom specified FETCH BODY command instead of building a FETCH command
with the data form the imap URL.
In the imap_state_select_resp function, where commands (e.g. search, fetch,
custom commands, etc...) are executed on receiving an OK response of a
"select" mailbox, I have added a check to verify if the custom command to
be executed is a fetch of a message body. If so, the new function
imap_perform_custom_fetch_body is invoked, otherwise the flow continues as
before by invoking the imap_perform_list function.
To me this seems ok now, but of course it's better to have it checked by
experts.
Thanks and BR,
Luca
Received on 2019-03-15