dovecot-2.1: imapc: Filter out X-Message-Flag: header from incom...
dovecot at dovecot.org
dovecot at dovecot.org
Tue Sep 20 15:36:55 EEST 2011
details: http://hg.dovecot.org/dovecot-2.1/rev/501b33c4aa28
changeset: 13524:501b33c4aa28
user: Timo Sirainen <tss at iki.fi>
date: Tue Sep 20 15:36:39 2011 +0300
description:
imapc: Filter out X-Message-Flag: header from incoming mails.
This is only added by MS Exchange when \Flagged flag is set, so it could be
made optional, but it probably doesn't really hurt to just make it
unconditional to ease the configuration.
diffstat:
src/lib-storage/index/imapc/imapc-mail-fetch.c | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diffs (43 lines):
diff -r a15a1b1994cc -r 501b33c4aa28 src/lib-storage/index/imapc/imapc-mail-fetch.c
--- a/src/lib-storage/index/imapc/imapc-mail-fetch.c Tue Sep 20 15:22:37 2011 +0300
+++ b/src/lib-storage/index/imapc/imapc-mail-fetch.c Tue Sep 20 15:36:39 2011 +0300
@@ -3,6 +3,7 @@
#include "lib.h"
#include "str.h"
#include "istream.h"
+#include "istream-header-filter.h"
#include "imap-arg.h"
#include "imap-date.h"
#include "imapc-client.h"
@@ -182,6 +183,23 @@
return FALSE;
}
+static void imapc_stream_filter(struct istream **input)
+{
+ static const char *imapc_hide_headers[] = {
+ /* Added by MS Exchange 2010 when \Flagged flag is set.
+ This violates IMAP guarantee of messages being immutable. */
+ "X-Message-Flag"
+ };
+ struct istream *filter_input;
+
+ filter_input = i_stream_create_header_filter(*input,
+ HEADER_FILTER_EXCLUDE,
+ imapc_hide_headers, N_ELEMENTS(imapc_hide_headers),
+ null_header_filter_callback, NULL);
+ i_stream_unref(input);
+ *input = filter_input;
+}
+
static void
imapc_fetch_stream(struct imapc_mail *mail,
const struct imapc_untagged_reply *reply,
@@ -230,6 +248,7 @@
t_strdup_printf("imapc mail uid=%u", _mail->uid));
index_mail_set_read_buffer_size(_mail, imail->data.stream);
+ imapc_stream_filter(&imail->data.stream);
if (imail->mail.v.istream_opened != NULL) {
if (imail->mail.v.istream_opened(_mail,
&imail->data.stream) < 0) {
More information about the dovecot-cvs
mailing list