Sieve \\Seen flag actions not replicated

Ken Murchison murch at andrew.cmu.edu
Tue Jan 2 12:42:07 EST 2007


John Capo wrote:
> Tiring of running fixup scripts to keep seen state consistent, I
> decided to find the problem.  In imap/lmtpd.c:
> 
>             sync_log_append(mailboxname); 
> +        
> +            if (nflags && user && !strncmp("user.", mailboxname, 5) && !strncmp(mailboxname + 5, user, strlen(user)))
> +                sync_log_seen(user, mailboxname);
>         }
> 
> The strncmps insure that the seen state is updated only for the
> user that owns the mailbox.  Are they neeed?

No, since you can set \Seen on shared mailboxes.  I haven't tested it, 
but I think this does the right thing.  Please let me know.

--- lmtpd.c.~1.145.~	2006-12-19 14:33:09.000000000 -0500
+++ lmtpd.c	2007-01-02 12:39:59.000000000 -0500
@@ -514,6 +514,16 @@
  	    syslog(LOG_INFO, "Delivered: %s to mailbox: %s", id, mailboxname);

  	    sync_log_append(mailboxname);
+
+	    if (user) {
+		/* check if the \Seen flag has been set on this message */
+		while (nflags) {
+		    if (!strcmp(flag[--nflags], "\\seen")) {
+			sync_log_seen(user, mailboxname);
+			break;
+		    }
+		}
+	    }
  	}
      }



-- 
Kenneth Murchison
Systems Programmer
Project Cyrus Developer/Maintainer
Carnegie Mellon University


More information about the Cyrus-devel mailing list