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

Re: [PATCH 01/14] imap-send.c: remove msg_data::flags, which was always zero

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Jan 14, 2013, 09:10 UTC
Message-ID
<50F3CB6A.40203@alum.mit.edu>
In-Reply-To
<20130114055721.GD3125@elie.Belkin>
On 01/14/2013 06:57 AM, Jonathan Nieder wrote:
Show 20 quoted lines
> Michael Haggerty wrote:
> 
>> This removes the need for function imap_make_flags(), so delete it,
>> too.
> [...]
>> --- a/imap-send.c
>> +++ b/imap-send.c
> [...]
>>  	box = gctx->name;
>>  	prefix = !strcmp(box, "INBOX") ? "" : ctx->prefix;
>>  	cb.create = 0;
>> -	ret = imap_exec_m(ctx, &cb, "APPEND \"%s%s\" %s", prefix, box, flagstr);
>> +	ret = imap_exec_m(ctx, &cb, "APPEND \"%s%s\"", prefix, box);
> 
> Before this change, the command is
> 
> 	"APPEND" SP mailbox SP "{" msglen "}" CRLF
> 
> .  After this change, it leaves out the space before the brace.  If I
> understand RFC3501 correctly, the space is required.  Intentional?

No, not intentional. I simply didn't follow far enough how the string was used and mistakenly thought it was an entire command. Thanks for finding and fixing this.

(It probably would be less error-prone if v_issue_imap_cmd() would be responsible for adding the extra space in the second branch of the following if statement:

    if (!cmd->cb.data)
            bufl = nfsnprintf(buf, sizeof(buf), "%d %s\r\n", cmd->tag,
cmd->cmd);
    else
            bufl = nfsnprintf(buf, sizeof(buf), "%d %s{%d%s}\r\n",
                              cmd->tag, cmd->cmd, cmd->cb.dlen,
                              CAP(LITERALPLUS) ? "+" : "");

but that's a design choice that was already in the original version and I don't care enough to change it.)

Show 17 quoted lines
> With the below squashed in,
> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
> 
> diff --git i/imap-send.c w/imap-send.c
> index 451d5027..f1c8f5a5 100644
> --- i/imap-send.c
> +++ w/imap-send.c
> @@ -1296,7 +1296,7 @@ static int imap_store_msg(struct store *gctx, struct msg_data *msg)
>  	box = gctx->name;
>  	prefix = !strcmp(box, "INBOX") ? "" : ctx->prefix;
>  	cb.create = 0;
> -	ret = imap_exec_m(ctx, &cb, "APPEND \"%s%s\"", prefix, box);
> +	ret = imap_exec_m(ctx, &cb, "APPEND \"%s%s\" ", prefix, box);
>  	imap->caps = imap->rcaps;
>  	if (ret != DRV_OK)
>  		return ret;
> 
ACK.
Michael
-- 
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/
Previous: Jonathan NiederNext: Michael Haggerty
Message 4 of 27 in “Remove unused code from imap-send.c”
  1. 00/14 Remove unused code from imap-send.cMichael Haggerty, Jan 14, 2013
  2. 01/14 imap-send.c: remove msg_data::flags, which was always zeroMichael Haggerty, Jan 14, 2013
  3. Jonathan NiederJan 14, 2013
  4. Michael HaggertyJan 14, 2013
  5. 02/14 imap-send.c: remove struct msg_dataMichael Haggerty, Jan 14, 2013
  6. 03/14 iamp-send.c: remove unused struct imap_store_confMichael Haggerty, Jan 14, 2013
  7. 04/14 imap-send.c: remove struct store_confMichael Haggerty, Jan 14, 2013
  8. 05/14 imap-send.c: remove struct messageMichael Haggerty, Jan 14, 2013
  9. 06/14 imap-send.c: remove some unused fields from struct storeMichael Haggerty, Jan 14, 2013
  10. Jonathan NiederJan 14, 2013
  11. Michael HaggertyJan 14, 2013
  12. 07/14 imap-send.c: inline imap_parse_list() in imap_list()Michael Haggerty, Jan 14, 2013
  13. 08/14 imap-send.c: remove struct imap argument to parse_imap_list_l()Michael Haggerty, Jan 14, 2013
  14. 09/14 imap-send.c: remove namespace fields from struct imapMichael Haggerty, Jan 14, 2013
  15. Jonathan NiederJan 14, 2013
  16. Michael HaggertyJan 14, 2013
  17. 10/14 imap-send.c: remove unused field imap_store::trashncMichael Haggerty, Jan 14, 2013
  18. 11/14 imap-send.c: simplify logic in lf_to_crlf()Michael Haggerty, Jan 14, 2013
  19. Jonathan NiederJan 14, 2013
  20. 12/14 imap-send.c: use struct imap_store instead of struct storeMichael Haggerty, Jan 14, 2013
  21. Jonathan NiederJan 14, 2013
  22. 13/14 imap-send.c: remove unused field imap_store::uidvalidityMichael Haggerty, Jan 14, 2013
  23. 14/14 imap-send.c: fold struct store into struct imap_storeMichael Haggerty, Jan 14, 2013
  24. Jeff KingJan 14, 2013
  25. Jonathan NiederJan 14, 2013
  26. Michael HaggertyJan 14, 2013
  27. Junio C HamanoJan 14, 2013

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.