# Custom Filter Framework

## Rules
A single rule should be able to match multiple things and have multipl
actions, i.e.:

### Example
```
Hdr1: regexp
Hdr2: regexp
<action1>
<action2>
```

### Misc
 * Pseudo header for To/CC.  Some way to say "directly to me" that works with
BCC.

## Use cases
 * Simple `To: me@example.com` -> add label `@Me`
 * `From: wife` only `To: me` vs `From: wife` & `To: multiple people`
 * `To: important CC: unimportant` still gets `@Important`
 * Mix AND, OR and negation in a single rule.

## Actions
 * Add label
 * Mark read

# Threading
 jwz or something simple first?  gmail has a nice property of being able to
 see message / thread ID by default, and then fetch by message or thread ID.
 Fetch by thread ID only way to do batch processing via API.

# Old Notes
 * Add `fast_header` table that is just the values we`d want to search on
 (i.e.  the headers we hash on, plus whatever is needed for jwz threading).
 * Investigate stored procedures that update `fast_header` automatically when
 we we add bulk headers to table `header`
