const char *mailbox;
const char *guid;
uint32_t uid;
+ time_t received_date;
};
static int
mailbox_save_set_uid(save_ctx, ctx->uid);
if (ctx->guid != NULL)
mailbox_save_set_guid(save_ctx, ctx->guid);
+ if (ctx->received_date != (time_t)-1)
+ mailbox_save_set_received_date(save_ctx, ctx->received_date, 0);
if (mailbox_save_begin(&save_ctx, input) < 0) {
e_error(ctx->ctx.cctx->event, "Saving failed: %s",
mailbox_get_last_internal_error(box, NULL));
struct doveadm_cmd_context *cctx = _ctx->cctx;
struct save_cmd_context *ctx =
container_of(_ctx, struct save_cmd_context, ctx);
+ const char *str;
+ bool utc;
(void)doveadm_cmd_param_str(cctx, "mailbox", &ctx->mailbox);
(void)doveadm_cmd_param_uint32(cctx, "uid", &ctx->uid);
(void)doveadm_cmd_param_str(cctx, "guid", &ctx->guid);
+ if (!doveadm_cmd_param_str(cctx, "received-date", &str))
+ ctx->received_date = (time_t)-1;
+ else {
+ if (mail_parse_human_timestamp(str, &ctx->received_date, &utc) < 0)
+ i_fatal("Invalid received-date '%s'", str);
+ }
+
doveadm_mail_get_input(_ctx);
}
DOVEADM_CMD_PARAM('m', "mailbox", CMD_PARAM_STR, 0)
DOVEADM_CMD_PARAM('U', "uid", CMD_PARAM_INT64, CMD_PARAM_FLAG_UNSIGNED)
DOVEADM_CMD_PARAM('g', "guid", CMD_PARAM_STR, 0)
+DOVEADM_CMD_PARAM('r', "received-date", CMD_PARAM_STR, 0)
DOVEADM_CMD_PARAM('\0', "file", CMD_PARAM_ISTREAM, CMD_PARAM_FLAG_POSITIONAL)
DOVEADM_CMD_PARAMS_END
};