fixup! [sieve] add parser support for imap4flags
[sieve] imap4flags support for bytecode decompiler

update sieved.c for imap4flags as follows:
- add hasflag test support to dump2_test()
- add :copy and :flags support to KEEP in dump2()
- add :flags support to FILEINTO in dump2()
bc_dump.c: hasflag test support

I can't find anywhere that bc_dump.c is actually used.  Is this work
useful?  Still need KEEP and FILEINTO support of :flags
[sieve] bc_emit.c: fix comment

Comments were backwards of what was actually happening.
Relation comes before comparator in the bytecode.
[sieve] only 'fileinto' once per folder (RFC 3028)

Make do_fileinto() consistent with do_keep() in that if the action is
requested a second time, simply disregard the second and subsequent
request.

RFC 3028 [SIEVE]:
2.10.3.  Message Uniqueness in a Mailbox

   Implementations SHOULD NOT deliver a message to the same folder more
   than once, even if a script explicitly asks for a message to be
   written to a mailbox twice.
[sieve] fileinto: ensure last flag list value wins (RFC 5232)

The naive way of eliminating duplicates resulted in the first
(rather than the last) flag list value winning.  A solution
is to move the action to the end of the action list, ensuring
the last flag list value wins.

RFC 5232 [imap4flags] Sec 3. Actions:
   Note that when keep/fileinto is used multiple times in a script and
   duplicate message elimination is performed (as described in Section
   2.10.3 of [SIEVE]), the last flag list value MUST win.

RFC 3028 [SIEVE]:
2.10.3.  Message Uniqueness in a Mailbox

   Implementations SHOULD NOT deliver a message to the same folder more
   than once, even if a script explicitly asks for a message to be
   written to a mailbox twice.
[sieve] keep: ensure last flag list value wins (RFC 5232)

The naive way of eliminating duplicates resulted in the first
(rather than the last) flag list value winning.  A solution
is to move the action to the end of the action list, ensuring
the last flag list value wins.

This change has been copied from do_fileinto() to do_keep()

RFC 5232 [imap4flags] Sec 3. Actions:
   Note that when keep/fileinto is used multiple times in a script and
   duplicate message elimination is performed (as described in Section
   2.10.3 of [SIEVE]), the last flag list value MUST win.

RFC 3028 [SIEVE]:
2.10.3.  Message Uniqueness in a Mailbox

   Implementations SHOULD NOT deliver a message to the same folder more
   than once, even if a script explicitly asks for a message to be
   written to a mailbox twice.
fixup! [sieve] imap4flags support for bytecode emitter
[sieve] bc_generate,bc_emit: put new parameter first

makes it easier to keep backwards compatibility with older
bytecode versions
[sieve] message.c: add :copy support to keep action
[sieve] bc_eval.c: boilerplate for hasflag test taken from header test
make sieve_() flag functions case insensitive
[sieve] bc_eval.c: inital support for keep and fileinto :flags argument
actionflags parameter for fileinto
[sieve] bc_emit.c: add comments for B_FILEINTO

make sure the order of parameters is well-defined
more comments for tests
[sieve] bc_eval.c: fixes to ip counting
[sieve] bc_eval.c: support for hasflag test

Track the current value of the internal flags variable so that the
hasflag test has something to compare to.
[sieve] bc_eval.c: pass workingflags to eval_bc_test() for hasflag test
[sieve] bc_eval.c: Initial attempt at imap4flags hasflag test

Should work with typical usage.  Need to evaluate for :count support.

Also added comment to bc_generate.c and bc_emit.c to add support for
:count to hasflag, possibly in conjunction with :regex