dovecot-2.2: lib-storage: Added mailbox_save_set_pop3_order() an...

dovecot at dovecot.org dovecot at dovecot.org
Sun May 20 03:26:30 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/82cd7aa65faf
changeset: 14399:82cd7aa65faf
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Mar 30 04:23:59 2012 +0300
description:
lib-storage: Added mailbox_save_set_pop3_order() and implemented for Maildir.

diffstat:

 src/lib-storage/index/maildir/maildir-save.c |  7 +++++++
 src/lib-storage/mail-storage-private.h       |  1 +
 src/lib-storage/mail-storage.c               |  8 ++++++++
 src/lib-storage/mail-storage.h               |  4 ++++
 4 files changed, 20 insertions(+), 0 deletions(-)

diffs (74 lines):

diff -r 78317179b4af -r 82cd7aa65faf src/lib-storage/index/maildir/maildir-save.c
--- a/src/lib-storage/index/maildir/maildir-save.c	Fri Mar 30 03:46:37 2012 +0300
+++ b/src/lib-storage/index/maildir/maildir-save.c	Fri Mar 30 04:23:59 2012 +0300
@@ -34,6 +34,7 @@
 
 	uoff_t size, vsize;
 	enum mail_flags flags;
+	unsigned int pop3_order;
 	unsigned int preserve_filename:1;
 	unsigned int keywords_count;
 	/* unsigned int keywords[]; */
@@ -187,6 +188,7 @@
 	}
 	if (_ctx->pop3_uidl != NULL)
 		mf->pop3_uidl = p_strdup(ctx->pool, _ctx->pop3_uidl);
+	mf->pop3_order = _ctx->pop3_order;
 
 	/* insert into index */
 	mail_index_append(ctx->trans, _ctx->uid, &ctx->seq);
@@ -929,6 +931,11 @@
 				MAILDIR_UIDLIST_REC_EXT_POP3_UIDL,
 				mf->pop3_uidl);
 		}
+		if (mf->pop3_order > 0) {
+			maildir_uidlist_sync_set_ext(ctx->uidlist_sync_ctx, rec,
+				MAILDIR_UIDLIST_REC_EXT_POP3_ORDER,
+				t_strdup_printf("%u", mf->pop3_order));
+		}
 	} T_END;
 	i_assert(!seq_range_array_iter_nth(&iter, n, &uid));
 }
diff -r 78317179b4af -r 82cd7aa65faf src/lib-storage/mail-storage-private.h
--- a/src/lib-storage/mail-storage-private.h	Fri Mar 30 03:46:37 2012 +0300
+++ b/src/lib-storage/mail-storage-private.h	Fri Mar 30 04:23:59 2012 +0300
@@ -444,6 +444,7 @@
 	uint32_t uid;
 	char *guid, *pop3_uidl, *from_envelope;
 	struct ostream *output;
+	unsigned int pop3_order;
 
 	struct mail_save_attachment *attach;
 
diff -r 78317179b4af -r 82cd7aa65faf src/lib-storage/mail-storage.c
--- a/src/lib-storage/mail-storage.c	Fri Mar 30 03:46:37 2012 +0300
+++ b/src/lib-storage/mail-storage.c	Fri Mar 30 04:23:59 2012 +0300
@@ -1588,6 +1588,14 @@
 	ctx->pop3_uidl = i_strdup(uidl);
 }
 
+void mailbox_save_set_pop3_order(struct mail_save_context *ctx,
+				 unsigned int order)
+{
+	i_assert(order > 0);
+
+	ctx->pop3_order = order;
+}
+
 void mailbox_save_set_dest_mail(struct mail_save_context *ctx,
 				struct mail *mail)
 {
diff -r 78317179b4af -r 82cd7aa65faf src/lib-storage/mail-storage.h
--- a/src/lib-storage/mail-storage.h	Fri Mar 30 03:46:37 2012 +0300
+++ b/src/lib-storage/mail-storage.h	Fri Mar 30 04:23:59 2012 +0300
@@ -647,6 +647,10 @@
 /* Set message's POP3 UIDL, if the backend supports it. */
 void mailbox_save_set_pop3_uidl(struct mail_save_context *ctx,
 				const char *uidl);
+/* Specify ordering for POP3 messages. The default is to add them to the end
+   of the mailbox. Not all backends support this. */
+void mailbox_save_set_pop3_order(struct mail_save_context *ctx,
+				 unsigned int order);
 /* 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


More information about the dovecot-cvs mailing list