add support for LITERAL- extension

it's the same as LITERAL+, only with a strongly limited payload size.
This commit is contained in:
Oswald Buddenhagen 2021-11-24 16:55:52 +01:00
parent 5048521d79
commit c5e967f94d

View File

@ -234,6 +234,7 @@ enum CAPABILITY {
#endif #endif
UIDPLUS, UIDPLUS,
LITERALPLUS, LITERALPLUS,
LITERALMINUS,
MOVE, MOVE,
NAMESPACE, NAMESPACE,
COMPRESS_DEFLATE COMPRESS_DEFLATE
@ -249,6 +250,7 @@ static const char *cap_list[] = {
#endif #endif
"UIDPLUS", "UIDPLUS",
"LITERAL+", "LITERAL+",
"LITERAL-",
"MOVE", "MOVE",
"NAMESPACE", "NAMESPACE",
"COMPRESS=DEFLATE" "COMPRESS=DEFLATE"
@ -315,7 +317,8 @@ send_imap_cmd( imap_store_t *ctx, imap_cmd_t *cmd )
if (cmd->param.data) { if (cmd->param.data) {
assert( cmdl > 2 && !memcmp( cmd->cmd + cmdl - 2, "+}", 2 ) ); assert( cmdl > 2 && !memcmp( cmd->cmd + cmdl - 2, "+}", 2 ) );
if ((!cmd->param.to_trash || ctx->trashnc != TrashUnknown) && if ((!cmd->param.to_trash || ctx->trashnc != TrashUnknown) &&
CAP(LITERALPLUS) && cmd->param.data_len <= 100*1024) { ((CAP(LITERALPLUS) && cmd->param.data_len <= 100*1024) ||
(CAP(LITERALMINUS) && cmd->param.data_len <= 4*1024))) {
litplus = 1; litplus = 1;
} else { } else {
cmd->cmd[cmdl - 2] = '}'; cmd->cmd[cmdl - 2] = '}';