Paul,

On Wed, 2009-08-26 at 16:14 +0200, Paul J Stevens wrote:
> Shane Kerr wrote:
> > All,
> > 
> > [ Apologies if this was fixed or otherwise addressed already. ]
> > 
> > 
> > I'm using dbmail 2.2.10, and it looks like the EXAMINE command is
> > marking messages as read when I FETCH them. This looks like a bug that
> > was fixed ages ago:
> > 
> > http://osdir.com/ml/mail.imap.dbmail.devel/2004-10/msg00124.html
> 
> Bug confirmed for 2.2.11
> But it's fixed in 2.3.6

Can you have a look at the attached patch against 2.2.11? I have no idea
if it is correct or not (I didn't even try to compile it), but it seems
like it might be more-or-less the right thing to do.

--
Shane
--- dbmail-imapsession.c.org	2009-08-26 17:08:29.000000000 +0200
+++ dbmail-imapsession.c	2009-08-26 17:10:47.576625914 +0200
@@ -811,6 +811,7 @@
 static int _fetch_get_items(struct ImapSession *self, u64_t *uid)
 {
 	int result;
+        int writeable;
 	u64_t actual_cnt, tmpdumpsize;
 	gchar *s = NULL;
 	
@@ -958,8 +959,15 @@
 			dbmail_imap_session_buff_append(self, "\r\n *BYE internal dbase error\r\n");
 			return -1;
 		}
+
+		/* also only adjust the seen flag if we can write to the mailbox */
+		writeable = acl_has_right(&ud->mailbox, ud->userid, ACL_RIGHT_WRITE);
+		if (writeable == -1) {
+			dbmail_imap_session_buff_append(self, "\r\n *BYE internal dbase error\r\n");
+			return -1;
+		}
 		
-		if (result == 1) {
+		if ((result == 1) && (writeable == 1)) {
 			result = db_set_msgflag(self->msg_idnr, ud->mailbox.uid, setSeenSet, IMAPFA_ADD);
 			if (result == -1) {
 				dbmail_imap_session_buff_append(self, "\r\n* BYE internal dbase error\r\n");
_______________________________________________
DBmail mailing list
[email protected]
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail

Reply via email to