Browse Source

simplify assembly of IMAP APPEND commands

treat the date string the same as the flag string.

amends eb1f1076.
wip/maildir-path-under-inbox
Oswald Buddenhagen 3 years ago
parent
commit
abd31aad61
  1. 22
      src/drv_imap.c

22
src/drv_imap.c

@ -3233,6 +3233,14 @@ imap_store_msg( store_t *gctx, msg_data_t *data, int to_trash,
flagstr[d++] = ' ';
}
flagstr[d] = 0;
if (data->date) {
DIAG_PUSH
DIAG_DISABLE("-Wformat") // configure ensures that %z actually works.
strftime( datestr, sizeof(datestr), "\"%d-%b-%Y %H:%M:%S %z\" ", localtime( &data->date ) );
DIAG_POP
} else {
datestr[0] = 0;
}
INIT_IMAP_CMD(imap_cmd_out_uid_t, cmd, cb, aux)
ctx->buffer_mem += data->len;
@ -3255,18 +3263,8 @@ imap_store_msg( store_t *gctx, msg_data_t *data, int to_trash,
return;
}
}
if (data->date) {
/* configure ensures that %z actually works. */
DIAG_PUSH
DIAG_DISABLE("-Wformat")
strftime( datestr, sizeof(datestr), "%d-%b-%Y %H:%M:%S %z", localtime( &data->date ) );
DIAG_POP
imap_exec( ctx, &cmd->gen, imap_store_msg_p2,
"APPEND \"%\\s\" %s\"%\\s\" ", buf, flagstr, datestr );
} else {
imap_exec( ctx, &cmd->gen, imap_store_msg_p2,
"APPEND \"%\\s\" %s", buf, flagstr );
}
imap_exec( ctx, &cmd->gen, imap_store_msg_p2,
"APPEND \"%\\s\" %s%s", buf, flagstr, datestr );
free( buf );
}

Loading…
Cancel
Save