Hello, I use FreeBSD 8.2-RELEASE-p7 i386 dovecot-2.1.6 dovecot-pigeonhole-0.3.0_1 I have the following problem: When I use the following script - the flag is set in \Seen : require ["imap4flags"]; # rule:[test] if anyof (header :contains "Subject" "test") { setflag "\\Seen"; stop; } . SELECT INBOX * OK [CLOSED] Previous mailbox closed. * FLAGS (\Answered \Flagged \Deleted \Seen \Draft) * OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft \*)] Flags permitted. * 1 EXISTS * 1 RECENT * OK [UIDVALIDITY 1338600150] UIDs valid * OK [UIDNEXT 9] Predicted next UID * OK [NOMODSEQ] No permanent modsequences . OK [READ-WRITE] Select completed. . FETCH 1 (UID FLAGS BODY.PEEK[HEADER.FIELDS (DATE SUBJECT)]) * 1 FETCH (UID 8 FLAGS (\Seen \Recent) BODY[HEADER.FIELDS (DATE SUBJECT)] {57} Date: Fri, 6 Jul 2012 14:02:49 +0000 Subject: test 1 ) . OK Fetch completed. But when I use following script - the flag is not set in \Seen require ["fileinto","imap4flags"]; # rule:[test] if anyof (header :contains "Subject" "test") { fileinto "INBOX.SPAM"; setflag "\\Seen"; stop; } . SELECT INBOX.SPAM * OK [CLOSED] Previous mailbox closed. * FLAGS (\Answered \Flagged \Deleted \Seen \Draft) * OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft \*)] Flags permitted. * 1 EXISTS * 1 RECENT * OK [UNSEEN 1] First unseen. * OK [UIDVALIDITY 1338600159] UIDs valid * OK [UIDNEXT 7] Predicted next UID * OK [NOMODSEQ] No permanent modsequences . OK [READ-WRITE] Select completed. . FETCH 1 (UID FLAGS BODY.PEEK[HEADER.FIELDS (DATE SUBJECT)]) * 1 FETCH (UID 6 FLAGS (\Recent) BODY[HEADER.FIELDS (DATE SUBJECT)] {57} Date: Fri, 6 Jul 2012 13:53:29 +0000 Subject: test 1 ) . OK Fetch completed. so it should be or is it a bug? -- Best regards, magic
On 06.07.2012 16:46, wrote Vyacheslav Biruk:> Hello, > > I use > FreeBSD 8.2-RELEASE-p7 i386 > dovecot-2.1.6 > dovecot-pigeonhole-0.3.0_1 > > I have the following problem:> But when I use following script - the flag is not set in \Seen > > require ["fileinto","imap4flags"]; > > # rule:[test] > if anyof (header :contains "Subject" "test") > { > fileinto "INBOX.SPAM"; > setflag "\\Seen"; > stop; > }This works for me... if anyof (header :contains "Subject" "test") { addflag "\\Seen"; fileinto "INBOX.SPAM"; stop; }
Op 7/6/2012 5:10 PM, e-frog schreef:> On 06.07.2012 16:46, wrote Vyacheslav Biruk: > >> But when I use following script - the flag is not set in \Seen >> >> require ["fileinto","imap4flags"]; >> >> # rule:[test] >> if anyof (header :contains "Subject" "test") >> { >> fileinto "INBOX.SPAM"; >> setflag "\\Seen"; >> stop; >> } > > This works for me... > > if anyof (header :contains "Subject" "test") > { > addflag "\\Seen"; > fileinto "INBOX.SPAM"; > stop; > }Short story: put addflag/setflag/removeflag commands always before the fileinto command you want to affect. Long story: in this form, the addflag command manipulates an internal variable that keeps record of the active flags. Once the fileinto command is used, the status of that variable is used to set flags for the stored message. Manipulating the active flags after storing the message with fileinto has no effect on that command anymore. Only subsequent other fileinto commands will notice the change. Read RFC5232 (http://tools.ietf.org/html/rfc5232) for more info. Regards, Stephan.