dovecot-2.0: lib-storage: Added mail_get_real_mail() that return...
dovecot at dovecot.org
dovecot at dovecot.org
Wed May 12 20:47:52 EEST 2010
details: http://hg.dovecot.org/dovecot-2.0/rev/a6150ca30304
changeset: 11288:a6150ca30304
user: Timo Sirainen <tss at iki.fi>
date: Wed May 12 19:47:26 2010 +0200
description:
lib-storage: Added mail_get_real_mail() that returns physical mail in a virtual mailbox.
diffstat:
src/lib-storage/index/cydir/cydir-mail.c | 1 +
src/lib-storage/index/dbox-multi/mdbox-mail.c | 1 +
src/lib-storage/index/dbox-single/sdbox-mail.c | 1 +
src/lib-storage/index/index-mail.c | 5 +++++
src/lib-storage/index/index-mail.h | 1 +
src/lib-storage/index/maildir/maildir-mail.c | 1 +
src/lib-storage/index/mbox/mbox-mail.c | 1 +
src/lib-storage/index/raw/raw-mail.c | 1 +
src/lib-storage/mail-storage-private.h | 1 +
src/lib-storage/mail-storage.h | 3 +++
src/lib-storage/mail.c | 7 +++++++
src/plugins/virtual/virtual-mail.c | 8 ++++++++
12 files changed, 31 insertions(+), 0 deletions(-)
diffs (158 lines):
diff -r 00771a8ab6fb -r a6150ca30304 src/lib-storage/index/cydir/cydir-mail.c
--- a/src/lib-storage/index/cydir/cydir-mail.c Wed May 12 17:17:39 2010 +0200
+++ b/src/lib-storage/index/cydir/cydir-mail.c Wed May 12 19:47:26 2010 +0200
@@ -142,6 +142,7 @@
index_mail_get_header_stream,
cydir_mail_get_stream,
index_mail_get_special,
+ index_mail_get_real_mail,
index_mail_update_flags,
index_mail_update_keywords,
index_mail_update_modseq,
diff -r 00771a8ab6fb -r a6150ca30304 src/lib-storage/index/dbox-multi/mdbox-mail.c
--- a/src/lib-storage/index/dbox-multi/mdbox-mail.c Wed May 12 17:17:39 2010 +0200
+++ b/src/lib-storage/index/dbox-multi/mdbox-mail.c Wed May 12 19:47:26 2010 +0200
@@ -208,6 +208,7 @@
index_mail_get_header_stream,
dbox_mail_get_stream,
dbox_mail_get_special,
+ index_mail_get_real_mail,
mdbox_mail_update_flags,
index_mail_update_keywords,
index_mail_update_modseq,
diff -r 00771a8ab6fb -r a6150ca30304 src/lib-storage/index/dbox-single/sdbox-mail.c
--- a/src/lib-storage/index/dbox-single/sdbox-mail.c Wed May 12 17:17:39 2010 +0200
+++ b/src/lib-storage/index/dbox-single/sdbox-mail.c Wed May 12 19:47:26 2010 +0200
@@ -98,6 +98,7 @@
index_mail_get_header_stream,
dbox_mail_get_stream,
dbox_mail_get_special,
+ index_mail_get_real_mail,
index_mail_update_flags,
index_mail_update_keywords,
index_mail_update_modseq,
diff -r 00771a8ab6fb -r a6150ca30304 src/lib-storage/index/index-mail.c
--- a/src/lib-storage/index/index-mail.c Wed May 12 17:17:39 2010 +0200
+++ b/src/lib-storage/index/index-mail.c Wed May 12 19:47:26 2010 +0200
@@ -1063,6 +1063,11 @@
}
}
+struct mail *index_mail_get_real_mail(struct mail *mail)
+{
+ return mail;
+}
+
struct mail *
index_mail_alloc(struct mailbox_transaction_context *t,
enum mail_fetch_field wanted_fields,
diff -r 00771a8ab6fb -r a6150ca30304 src/lib-storage/index/index-mail.h
--- a/src/lib-storage/index/index-mail.h Wed May 12 17:17:39 2010 +0200
+++ b/src/lib-storage/index/index-mail.h Wed May 12 19:47:26 2010 +0200
@@ -194,6 +194,7 @@
struct istream **stream_r);
int index_mail_get_special(struct mail *_mail, enum mail_fetch_field field,
const char **value_r);
+struct mail *index_mail_get_real_mail(struct mail *mail);
void index_mail_update_flags(struct mail *mail, enum modify_type modify_type,
enum mail_flags flags);
diff -r 00771a8ab6fb -r a6150ca30304 src/lib-storage/index/maildir/maildir-mail.c
--- a/src/lib-storage/index/maildir/maildir-mail.c Wed May 12 17:17:39 2010 +0200
+++ b/src/lib-storage/index/maildir/maildir-mail.c Wed May 12 19:47:26 2010 +0200
@@ -585,6 +585,7 @@
index_mail_get_header_stream,
maildir_mail_get_stream,
maildir_mail_get_special,
+ index_mail_get_real_mail,
index_mail_update_flags,
index_mail_update_keywords,
index_mail_update_modseq,
diff -r 00771a8ab6fb -r a6150ca30304 src/lib-storage/index/mbox/mbox-mail.c
--- a/src/lib-storage/index/mbox/mbox-mail.c Wed May 12 17:17:39 2010 +0200
+++ b/src/lib-storage/index/mbox/mbox-mail.c Wed May 12 19:47:26 2010 +0200
@@ -403,6 +403,7 @@
index_mail_get_header_stream,
mbox_mail_get_stream,
mbox_mail_get_special,
+ index_mail_get_real_mail,
index_mail_update_flags,
index_mail_update_keywords,
index_mail_update_modseq,
diff -r 00771a8ab6fb -r a6150ca30304 src/lib-storage/index/raw/raw-mail.c
--- a/src/lib-storage/index/raw/raw-mail.c Wed May 12 17:17:39 2010 +0200
+++ b/src/lib-storage/index/raw/raw-mail.c Wed May 12 19:47:26 2010 +0200
@@ -132,6 +132,7 @@
index_mail_get_header_stream,
raw_mail_get_stream,
raw_mail_get_special,
+ index_mail_get_real_mail,
index_mail_update_flags,
index_mail_update_keywords,
index_mail_update_modseq,
diff -r 00771a8ab6fb -r a6150ca30304 src/lib-storage/mail-storage-private.h
--- a/src/lib-storage/mail-storage-private.h Wed May 12 17:17:39 2010 +0200
+++ b/src/lib-storage/mail-storage-private.h Wed May 12 19:47:26 2010 +0200
@@ -306,6 +306,7 @@
int (*get_special)(struct mail *mail, enum mail_fetch_field field,
const char **value_r);
+ struct mail *(*get_real_mail)(struct mail *mail);
void (*update_flags)(struct mail *mail, enum modify_type modify_type,
enum mail_flags flags);
diff -r 00771a8ab6fb -r a6150ca30304 src/lib-storage/mail-storage.h
--- a/src/lib-storage/mail-storage.h Wed May 12 17:17:39 2010 +0200
+++ b/src/lib-storage/mail-storage.h Wed May 12 19:47:26 2010 +0200
@@ -660,6 +660,9 @@
/* Get any of the "special" fields. Unhandled specials are returned as "". */
int mail_get_special(struct mail *mail, enum mail_fetch_field field,
const char **value_r);
+/* Returns the mail for the physical message. Normally this is the mail itself,
+ but in virtual mailboxes it points to the backend mailbox. */
+struct mail *mail_get_real_mail(struct mail *mail);
/* Update message flags. */
void mail_update_flags(struct mail *mail, enum modify_type modify_type,
diff -r 00771a8ab6fb -r a6150ca30304 src/lib-storage/mail.c
--- a/src/lib-storage/mail.c Wed May 12 17:17:39 2010 +0200
+++ b/src/lib-storage/mail.c Wed May 12 19:47:26 2010 +0200
@@ -180,6 +180,13 @@
return p->v.get_special(mail, field, value_r);
}
+struct mail *mail_get_real_mail(struct mail *mail)
+{
+ struct mail_private *p = (struct mail_private *)mail;
+
+ return p->v.get_real_mail(mail);
+}
+
void mail_update_flags(struct mail *mail, enum modify_type modify_type,
enum mail_flags flags)
{
diff -r 00771a8ab6fb -r a6150ca30304 src/plugins/virtual/virtual-mail.c
--- a/src/plugins/virtual/virtual-mail.c Wed May 12 17:17:39 2010 +0200
+++ b/src/plugins/virtual/virtual-mail.c Wed May 12 19:47:26 2010 +0200
@@ -346,6 +346,13 @@
return 0;
}
+static struct mail *virtual_mail_get_real_mail(struct mail *mail)
+{
+ struct virtual_mail *vmail = (struct virtual_mail *)mail;
+
+ return mail_get_real_mail(vmail->backend_mail);
+}
+
static void virtual_mail_update_pop3_uidl(struct mail *mail, const char *uidl)
{
struct virtual_mail *vmail = (struct virtual_mail *)mail;
@@ -401,6 +408,7 @@
virtual_mail_get_header_stream,
virtual_mail_get_stream,
virtual_mail_get_special,
+ virtual_mail_get_real_mail,
index_mail_update_flags,
index_mail_update_keywords,
index_mail_update_modseq,
More information about the dovecot-cvs
mailing list