git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] imap-send: add option to mark sent messages as read or unread

From
Aditya Garg <gargaditya08@live.com>
Date
Jul 23, 2025, 17:33 UTC
Message-ID
<PN3PR01MB95970E44092A27F47AF25CF8B85FA@PN3PR01MB9597.INDPRD01.PROD.OUTLOOK.COM>
In-Reply-To
<xmqqecu6om3t.fsf@gitster.g>
Show 13 quoted lines
> On 23 Jul 2025, at 10:55 PM, Junio C Hamano <gitster@pobox.com> wrote:
> 
> Aditya Garg <gargaditya08@live.com> writes:
> 
>> +imap.markAsRead::
>> +    Choose whether to mark the sent message as read or not.
> 
> Is this something user typically want to use a single setting,
> or would it often be per invocation?  Especially with the new
> invoker in send-email, wouldn't it become more like "if I use
> imap-send to stuff things in my outgoing folder, they shouldn't be
> marked as read, but fcc copies send-email stuffs via imap-send
> should be marked as read" or something like that?
So whenever the user changes the folder, he can change this option too?
Also, we have a command line way as well.
Show 5 quoted lines
> 
>> +    Default is `true`.
> 
> If we never marked these messages as read, then this default is a
> breaking change, isn't it?
Curl always marked the messages as read, so how would it be a breaking change? As far as OpenSSL is concerned, it marks the messages as unread, but due to issues with the license, as long as people are compiling git themselves, I doubt people are using it.
Also, were people really using imap-send itself?
Show 16 quoted lines
> 
>> @@ -47,11 +47,12 @@
>> 
>> static int verbosity;
>> static int list_folders;
>> +static int mark_seen = 1;
> 
> IOW, this smells problematic.
> 
>> +    if (mark_seen) {
>> +        ret = imap_exec_m(ctx, &cb, "APPEND \"%s%s\" (\\Seen) ", prefix, box);
>> +    } else {
>> +        ret = imap_exec_m(ctx, &cb, "APPEND \"%s%s\" ", prefix, box);
>> +    }
> 
> Why so many braces around single-statement blocks?
Will fix
Show 21 quoted lines
> 
>> @@ -1702,6 +1710,12 @@ static int curl_append_msgs_to_imap(struct imap_server_conf *server,
>>    curl_easy_setopt(curl, CURLOPT_READFUNCTION, fread_buffer);
>>    curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
>> 
>> +    if (mark_seen) {
>> +        curl_easy_setopt(curl, CURLOPT_UPLOAD_FLAGS, CURLULFLAG_SEEN);
>> +    } else {
>> +        curl_easy_setopt(curl, CURLOPT_UPLOAD_FLAGS, 0L);
>> +    }
>> +
> 
> Why so many braces around single-statement blocks?
> 
> According to
> 
> https://github.com/curl/curl/blob/master/docs/libcurl/symbols-in-versions
> 
> CURLULFLAG_SEEN first appeared in 8.13.0; INSTALL says we require 7.61.0
> or later, so this may be OK.
> 
Previous: Junio C HamanoNext: Aditya Garg
Message 3 of 8 in “imap-send: add option to mark sent messages as read or unread”
  1. imap-send: add option to mark sent messages as read or unreadAditya Garg, Jul 23, 2025
  2. Junio C HamanoJul 23, 2025
  3. Aditya GargJul 23, 2025
  4. Aditya GargJul 23, 2025
  5. Junio C HamanoJul 23, 2025
  6. Aditya GargJul 23, 2025
  7. Junio C HamanoJul 23, 2025
  8. Junio C HamanoJul 23, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.