Most of them aren't yet implemented by backends.
--HG--
branch : HEAD
enum mail_flags save_flags;
save_flags = ctx->ctx.flags & ~MAIL_RECENT;
- mail_index_append(ctx->trans, 0, &ctx->seq);
+ mail_index_append(ctx->trans, ctx->ctx.uid, &ctx->seq);
mail_index_update_flags(ctx->trans, ctx->seq, MODIFY_REPLACE,
save_flags);
if (ctx->ctx.keywords != NULL) {
{
i_free_and_null(ctx->from_envelope);
i_free_and_null(ctx->guid);
+ i_free_and_null(ctx->pop3_uidl);
}
ctx->failed = TRUE;
}
+ if (_ctx->save_date != (time_t)-1) {
+ /* we can't change ctime, but we can add the date to cache */
+ struct index_mail *mail = (struct index_mail *)_ctx->dest_mail;
+ uint32_t t = _ctx->save_date;
+
+ index_mail_cache_add(mail, MAIL_CACHE_SAVE_DATE, &t, sizeof(t));
+ }
+
if (ctx->ctx.received_date != (time_t)-1) {
/* set the received_date by modifying mtime */
buf.actime = ioloop_time;
enum mail_flags flags;
struct mail_keywords *keywords;
- time_t received_date;
+ time_t received_date, save_date;
int received_tz_offset;
- char *guid, *from_envelope;
+ uint32_t uid;
+ char *guid, *pop3_uidl, *from_envelope;
struct ostream *output;
};
ctx = t->box->v.save_alloc(t);
ctx->received_date = (time_t)-1;
+ ctx->save_date = (time_t)-1;
return ctx;
}
ctx->received_tz_offset = timezone_offset;
}
+void mailbox_save_set_save_date(struct mail_save_context *ctx,
+ time_t save_date)
+{
+ ctx->save_date = save_date;
+}
+
void mailbox_save_set_from_envelope(struct mail_save_context *ctx,
const char *envelope)
{
ctx->from_envelope = i_strdup(envelope);
}
+void mailbox_save_set_uid(struct mail_save_context *ctx, uint32_t uid)
+{
+ ctx->uid = uid;
+}
+
void mailbox_save_set_guid(struct mail_save_context *ctx, const char *guid)
{
i_assert(guid == NULL || *guid != '\0');
ctx->guid = i_strdup(guid);
}
+void mailbox_save_set_pop3_uidl(struct mail_save_context *ctx, const char *uidl)
+{
+ i_free(ctx->pop3_uidl);
+ ctx->pop3_uidl = i_strdup(uidl);
+}
+
void mailbox_save_set_dest_mail(struct mail_save_context *ctx,
struct mail *mail)
{
backend doesn't support storing it. */
void mailbox_save_set_received_date(struct mail_save_context *ctx,
time_t received_date, int timezone_offset);
+/* Set the "message saved" date. This should be set only when you're
+ replicating/restoring an existing mailbox. */
+void mailbox_save_set_save_date(struct mail_save_context *ctx,
+ time_t save_date);
/* Set the envelope sender. This is currently used only with mbox files to
specify the address in From_-line. */
void mailbox_save_set_from_envelope(struct mail_save_context *ctx,
const char *envelope);
+/* Set message's UID. If UID is smaller than the current next_uid, it's given
+ a new UID anyway. */
+void mailbox_save_set_uid(struct mail_save_context *ctx, uint32_t uid);
/* Set globally unique ID for the saved mail. A new GUID is generated by
default. This function should usually be called only when copying an
existing mail (or restoring a mail from backup). */
void mailbox_save_set_guid(struct mail_save_context *ctx, const char *guid);
+/* Set message's POP3 UIDL, if the backend supports it. */
+void mailbox_save_set_pop3_uidl(struct mail_save_context *ctx,
+ const char *uidl);
/* If dest_mail is set, the saved message can be accessed using it. Note that
setting it may require mailbox syncing, so don't set it unless you need
it. Also you shouldn't try to access it before mailbox_save_finish() is