[Dovecot] Handling of X-Status flags
Bernard Blackham
b-dovecot at blackham.com.au
Mon Sep 29 15:16:02 EEST 2003
Hi all,
I've done a bit of searching and haven't seen anybody else coming
across this problem yet:
I noticed that Dovecot uses the opposite flags for marking messages
as deleted and draft to most other MUAs I've seen or used:
With PINE, mutt and uw-imapd at least, messages are marked with
X-Status 'D' for Deleted, and 'T' for drafT. Dovecot reverses this
behaviour, using 'D' for Draft, and 'T' for Trashed.
Was there any reason behind this? Or have I gone loopy? At our site,
we have users reading mail with a mix of PINE locally, and through
dovecot via WebMail and there seems to arise a bit of confusion
between the two flags.
Attached is a patch that reverses this behaviour (prepared against
0.99.10 but applies with a little fuzz to cvs). I'd like to hear
people's comments on the issue... is it just me? :)
Thanks,
Bernard.
--
Bernard Blackham
bernard at blackham dot com dot au
-------------- next part --------------
diff -ruN dovecot-0.99.10/src/lib-index/maildir/maildir-index.c dovecot-0.99.10.brb/src/lib-index/maildir/maildir-index.c
--- dovecot-0.99.10/src/lib-index/maildir/maildir-index.c Fri Jun 27 00:11:06 2003
+++ dovecot-0.99.10.brb/src/lib-index/maildir/maildir-index.c Sat Sep 27 13:17:04 2003
@@ -109,10 +109,10 @@
case 'S': /* seen */
flags |= MAIL_SEEN;
break;
- case 'T': /* trashed */
+ case 'D': /* trashed */
flags |= MAIL_DELETED;
break;
- case 'D': /* draft */
+ case 'T': /* draft */
flags |= MAIL_DRAFT;
break;
case 'F': /* flagged */
@@ -168,9 +168,9 @@
nextflag = *oldflags == '\0' || *oldflags == ',' ? 256 :
(unsigned char) *oldflags;
- if ((flags & MAIL_DRAFT) && nextflag > 'D') {
+ if ((flags & MAIL_DELETED) && nextflag > 'D') {
str_append_c(flags_str, 'D');
- flags &= ~MAIL_DRAFT;
+ flags &= ~MAIL_DELETED;
}
if ((flags & MAIL_FLAGGED) && nextflag > 'F') {
str_append_c(flags_str, 'F');
@@ -184,9 +184,9 @@
str_append_c(flags_str, 'S');
flags &= ~MAIL_SEEN;
}
- if ((flags & MAIL_DELETED) && nextflag > 'T') {
+ if ((flags & MAIL_DRAFT) && nextflag > 'T') {
str_append_c(flags_str, 'T');
- flags &= ~MAIL_DELETED;
+ flags &= ~MAIL_DRAFT;
}
if ((flags & MAIL_CUSTOM_FLAGS_MASK) && nextflag > 'a') {
diff -ruN dovecot-0.99.10/src/lib-index/mbox/mbox-index.c dovecot-0.99.10.brb/src/lib-index/mbox/mbox-index.c
--- dovecot-0.99.10/src/lib-index/mbox/mbox-index.c Mon May 19 15:26:46 2003
+++ dovecot-0.99.10.brb/src/lib-index/mbox/mbox-index.c Sat Sep 27 13:19:41 2003
@@ -157,13 +157,13 @@
case 'F':
flags |= MAIL_FLAGGED;
break;
- case 'D':
+ case 'T':
flags |= MAIL_DRAFT;
break;
case 'R':
flags |= MAIL_SEEN;
break;
- case 'T':
+ case 'D':
flags |= MAIL_DELETED;
break;
}
diff -ruN dovecot-0.99.10/src/lib-index/mbox/mbox-rewrite.c dovecot-0.99.10.brb/src/lib-index/mbox/mbox-rewrite.c
--- dovecot-0.99.10/src/lib-index/mbox/mbox-rewrite.c Sun Jun 15 11:43:05 2003
+++ dovecot-0.99.10.brb/src/lib-index/mbox/mbox-rewrite.c Sat Sep 27 13:19:54 2003
@@ -210,9 +210,9 @@
str = t_strconcat("X-Status: ",
(ctx->msg_flags & MAIL_ANSWERED) ? "A" : "",
- (ctx->msg_flags & MAIL_DRAFT) ? "D" : "",
+ (ctx->msg_flags & MAIL_DELETED) ? "D" : "",
(ctx->msg_flags & MAIL_FLAGGED) ? "F" : "",
- (ctx->msg_flags & MAIL_DELETED) ? "T" : "",
+ (ctx->msg_flags & MAIL_DRAFT) ? "T" : "",
x_status, NULL);
if (o_stream_send_str(ctx->output, str) < 0)
diff -ruN dovecot-0.99.10/src/lib-storage/index/mbox/mbox-save.c dovecot-0.99.10.brb/src/lib-storage/index/mbox/mbox-save.c
--- dovecot-0.99.10/src/lib-storage/index/mbox/mbox-save.c Sun Jun 15 11:43:05 2003
+++ dovecot-0.99.10.brb/src/lib-storage/index/mbox/mbox-save.c Sat Sep 27 13:20:28 2003
@@ -131,11 +131,11 @@
if ((flags & MAIL_ANSWERED) != 0)
str_append_c(str, 'A');
- if ((flags & MAIL_DRAFT) != 0)
+ if ((flags & MAIL_DELETED) != 0)
str_append_c(str, 'D');
if ((flags & MAIL_FLAGGED) != 0)
str_append_c(str, 'F');
- if ((flags & MAIL_DELETED) != 0)
+ if ((flags & MAIL_DRAFT) != 0)
str_append_c(str, 'T');
str_append_c(str, '\n');
}
More information about the dovecot
mailing list