[sieve] Anticipate bytecode changes for VARIABLES extension

Combined generation of bytecode for hasflag test and header test into
a single case.

The bytecode changes for the set/add/remove-flag actions will be done
at a later date since they will be re-definitions anyway.
[sieve] bc_dump.c: support imap4flags keep, fileinto, hasflag

Added support for dumping mostly-flat bytecode as generated by
bc_generate.c for the modified keep and fileinto actions, supporting
the :flags argument.  Also added support for dumping mostly-flat
bytecode for new hasflag test.

Modified the comment at the start of the file to better describe the
file.
[sieve] sieved: update bytecode decompiler for imap4flags

:flags arguments to keep and fileinto actions
hasflag test
[sieve] added varlist.{c,h} in anticipation of the variables extension

Defines a named linked-list of strarray_t's.  Each variable is stored as
a strarray_t in var, with the variable name stored as a string in name.
[sieve] remove dependence on actionflags parameter

The imap4flags extension introduced an actionflags parameter.  It
helped decide whether to use the internal imapflags variable when
appending a message, or whether to use user-specified flags when filing
the message.  This commit removes dependence on that parameter.  The
actionflags parameter can now safely be removed.
[sieve] bc_eval.c: add :count match-type support to hasflag test

We can't have :count and :regex at the same time since they are both
MATCH-TYPEs
[sieve] move verify_flaglist() to flags.c for reuse elsewhere

Once we add the variables extension, we won't be able to check for
flag validity in the parser (sieve.y).  This allows us to use
verify_flaglist() wherever else we need it.
[sieve] sieve.y: an invalid flag should not cause a parsing error

[IMAP4FLAGS] Section 2 "General Requirements for Flag Handling" says
"If a flag validity check fails, the flag MUST be ignored", which for
us means that we simply remove the invalid flag from the list.
[sieve] properly handle NULL flag lists

message.c:
- changed do_setflag() to only clear out the flag list
 - use do_addflag() to add any flags after clearing the list

script.c:
- ACTION_SETFLAG: only clear out the flag list

bc_eval.c:
- B_KEEP, B_FILEINTO, B_SETFLAG: only add non-null strings to flaglist
- B_SETFLAG: consolidate addflag code

sieve.y:
 If a flag list is empty after sanitization, add a single empty string
 to the list.  This allows the bytecode to reflect the difference
 between no :flags parameter, and a :flags "" parameter specifying that
 there should be no flags applied.
Revert "[sieve] update sieve_fileinto() and sieve_keep() to use :flags parameter"

This removes the actionflags parameter that we added earlier on in
implementing the imap4flags sieve extension.  Since we have removed
dependence on this parameter, we can remove it from the functions that
previously used it.
[sieve] complete removal of no-longer-used actionflags parameter

Removed actionflags parameter from do_fileinto(), do_keep(),
sieve_fileinto_context_t, and sieve_keep_context_t
[sieve] remove superfluous sieve_addflag() and _removeflag() functions

- strarray_add_case() is identical to sieve_addflag()
- strarray_remove_all_case() is identical to sieve_removeflag()
[sieve] bytecode: don't emit unused :index parameter for hasflag test

We initially used identical bytecode for header and hasflag tests.
This patch makes the bytecode formats differ by using a code position
for the :index argument only in the case of a header test.
[sieve] sieve.y: remove bytecode dependence on sieve.y

The internally #define'd COPY was unnecessarily assigned to a structure
that ended up being part of the bytecode.  Since it is a true/false
value, we simply assign a value of 1 instead of the value of COPY.
[sieve] add legacy test cases for hasflag test
[sieve] Date and Index Extensions: return false instead of SIEVE_FAIL

From [RFC5260] Section 4. Date Test
   The date test returns false unconditionally if the specified header
   field does not exist, the field exists but does not contain a
   syntactically valid date-time specification, the date-time isn't
   valid according to the rules of the calendar system (e.g., January
   32nd, February 29 in a non-leap year), or the resulting string fails
   to match any key-list value.

Section 6. Index Extension does not specify what to do if the specific
occurrence of the header field does not exist.  It makes sense to
return false in this case instead of SIEVE_FAIL.

SIEVE_FAIL cancels execution of the entire script, which causes the
message to fall back to the implicit keep.