initial import of code to count messages from gmail

Benjamin Mako Hill || Want to submit a patch?