changeset 3204:c8fffa286b6a HEAD

Renamed oe6-fetch-no-newmail workaround to delay-newmail and changed it to work more like the name says: only newmail notifications are skipped and not only for FETCH command.
author Timo Sirainen <tss@iki.fi>
date Mon, 14 Mar 2005 23:17:58 +0200
parents 391a1064872e
children 0ddbe4de5a84
files dovecot-example.conf src/imap/cmd-fetch.c src/imap/common.h src/imap/imap-sync.c src/imap/main.c src/lib-storage/index/index-sync.c src/lib-storage/mail-storage.h
diffstat 7 files changed, 21 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/dovecot-example.conf	Mon Mar 14 22:48:25 2005 +0200
+++ b/dovecot-example.conf	Mon Mar 14 23:17:58 2005 +0200
@@ -402,11 +402,13 @@
   #login_greeting_capability = no
 
   # Workarounds for various client bugs:
-  #   oe6-fetch-no-newmail:
-  #     Never send EXISTS/RECENT when replying to FETCH command. Outlook Express
-  #     seems to think they are FETCH replies and gives user "Message no longer
-  #     in server" error. Note that OE6 still breaks even with this workaround
-  #     if synchronization is set to "Headers Only".
+  #   delay-newmail:
+  #     Send EXISTS/RECENT new mail notifications only when replying to NOOP
+  #     and CHECK commands. Some clients ignore them otherwise, for example
+  #     OSX Mail. Outlook Express breaks more badly though, without this it
+  #     may show user "Message no longer in server" errors. Note that OE6 still
+  #     breaks even with this workaround if synchronization is set to
+  #     "Headers Only".
   #   outlook-idle:
   #     Outlook and Outlook Express never abort IDLE command, so if no mail
   #     arrives in half a hour, Dovecot closes the connection. This is still
--- a/src/imap/cmd-fetch.c	Mon Mar 14 22:48:25 2005 +0200
+++ b/src/imap/cmd-fetch.c	Mon Mar 14 23:17:58 2005 +0200
@@ -102,14 +102,9 @@
 		return TRUE;
 	}
 
-	if ((client_workarounds & WORKAROUND_OE6_FETCH_NO_NEWMAIL) != 0) {
-		client_send_tagline(cmd, ok_message);
-		return TRUE;
-	} else {
-		return cmd_sync(cmd, MAILBOX_SYNC_FLAG_FAST |
-				(cmd->uid ? 0 : MAILBOX_SYNC_FLAG_NO_EXPUNGES),
-				ok_message);
-	}
+	return cmd_sync(cmd, MAILBOX_SYNC_FLAG_FAST |
+			(cmd->uid ? 0 : MAILBOX_SYNC_FLAG_NO_EXPUNGES),
+			ok_message);
 }
 
 static int cmd_fetch_continue(struct client_command_context *cmd)
--- a/src/imap/common.h	Mon Mar 14 22:48:25 2005 +0200
+++ b/src/imap/common.h	Mon Mar 14 23:17:58 2005 +0200
@@ -24,7 +24,7 @@
 #define DEFAULT_MAX_KEYWORD_LENGTH 50
 
 enum client_workarounds {
-	WORKAROUND_OE6_FETCH_NO_NEWMAIL		= 0x01,
+	WORKAROUND_DELAY_NEWMAIL		= 0x01,
 	WORKAROUND_OUTLOOK_IDLE			= 0x02,
 	WORKAROUND_NETSCAPE_EOH			= 0x04,
 	WORKAROUND_TB_NEGATIVE_FETCH		= 0x08
--- a/src/imap/imap-sync.c	Mon Mar 14 22:48:25 2005 +0200
+++ b/src/imap/imap-sync.c	Mon Mar 14 23:17:58 2005 +0200
@@ -190,6 +190,10 @@
 		return TRUE;
 	}
 
+	if ((client_workarounds & WORKAROUND_DELAY_NEWMAIL) != 0 &&
+	    (flags & MAILBOX_SYNC_FLAG_FAST) != 0)
+		flags |= MAILBOX_SYNC_FLAG_NO_NEWMAIL;
+
 	ctx = p_new(cmd->pool, struct cmd_sync_context, 1);
 	ctx->tagline = p_strdup(cmd->pool, tagline);
 	ctx->sync_ctx = imap_sync_init(cmd->client, cmd->client->mailbox,
--- a/src/imap/main.c	Mon Mar 14 22:48:25 2005 +0200
+++ b/src/imap/main.c	Mon Mar 14 23:17:58 2005 +0200
@@ -29,7 +29,7 @@
 };
 
 struct client_workaround_list client_workaround_list[] = {
-	{ "oe6-fetch-no-newmail", WORKAROUND_OE6_FETCH_NO_NEWMAIL },
+	{ "delay-newmail", WORKAROUND_DELAY_NEWMAIL },
 	{ "outlook-idle", WORKAROUND_OUTLOOK_IDLE },
 	{ "netscape-eoh", WORKAROUND_NETSCAPE_EOH },
 	{ "tb-negative-fetch", WORKAROUND_TB_NEGATIVE_FETCH },
--- a/src/lib-storage/index/index-sync.c	Mon Mar 14 22:48:25 2005 +0200
+++ b/src/lib-storage/index/index-sync.c	Mon Mar 14 23:17:58 2005 +0200
@@ -144,6 +144,8 @@
 	sync_mask = MAIL_INDEX_SYNC_MASK_ALL;
 	if ((flags & MAILBOX_SYNC_FLAG_NO_EXPUNGES) != 0)
 		sync_mask &= ~MAIL_INDEX_SYNC_TYPE_EXPUNGE;
+	if ((flags & MAILBOX_SYNC_FLAG_NO_NEWMAIL) != 0)
+		sync_mask &= ~MAIL_INDEX_SYNC_TYPE_APPEND;
 
 	if (mail_index_view_sync_begin(ibox->view, sync_mask,
 				       &ctx->sync_ctx) < 0) {
--- a/src/lib-storage/mail-storage.h	Mon Mar 14 22:48:25 2005 +0200
+++ b/src/lib-storage/mail-storage.h	Mon Mar 14 23:17:58 2005 +0200
@@ -104,8 +104,10 @@
 
 	/* Don't sync expunges from our view */
 	MAILBOX_SYNC_FLAG_NO_EXPUNGES	= 0x08,
+	/* Don't show new mail */
+	MAILBOX_SYNC_FLAG_NO_NEWMAIL	= 0x10,
 	/* Stop auto syncing */
-	MAILBOX_SYNC_AUTO_STOP		= 0x10
+	MAILBOX_SYNC_AUTO_STOP		= 0x20
 };
 
 enum mailbox_sync_type {