Better structlog logging in models/message.py.
Properly configure logging level.
Fix KeyError in Gmail mailsync's add_new_imapuids()

Messages can still move around while a given IMAP session is open, so
sometimes we'll start adding ImapUid entries but not get the flag info
while the message is still in the given folder. (For example, when a
message is archived in the middle of this operation.)

The right thing to do in this situation is to skip adding the ImapUid
entry; we'll catch the message later via the All Mail sync.
Fix call to update_imap_flags in order to properly set is_draft attribute.

Gmail uses a '\\Draft` *label*, not the '\\Draft' IMAP flag, so by omitting
that second parameter we weren't marking synced drafts as such.
Don't check is_latest attribute on drafts that aren't SpoolMessage instances.

Fixes T157.
Remove bad assertion and skip missing UIDs instead.

Similar to the KeyError issue, if UIDs disappear in the middle of a flag
update operation, we just shouldn't update them.

Fixes T153.
Set loglevel for logging fixture.
Fix type error when syncing back an unarchive action.

We were passing a Folder object to remote_move(), but that function expects a
folder name. Fix this, and rename the parameters to be more explicit.
[SCHEMA] Store client_id and client_secret on GmailAccount objects.

This is an interim change to allow account syncs to run using a developer's
client ID and client secret, as opposed to the ones specified in the sync
engine config. If these parameters aren't stored, we still use the configured
ones, so that auth and sync in the dev VM work as before.
Remove unused imports in mailsync/backends/base.py.
[SCHEMA] Canonicalize email addresses when comparing them.

Summary:
Specifically, this currently means removing any periods from Gmail addresses.
We'll still return whatever form was originally stored. I.e., if you authed as
ben.bitdiddle@gmail.com, that's what we use to send, and return in `/n/` API
queries, etc.

Test Plan:
Unit tests updated; auth and sending behavior manually tested; ran a
sync without breakage.

Reviewers: spang

Reviewed By: spang

Differential Revision: https://review.inboxapp.com/D245
Don't store Message.mailing_list_info or Thread.mailing_list_info columns.

Summary: We weren't using them for anything. Fixes T156.

Test Plan: Sync run.

Reviewers: kav-ya

Reviewed By: kav-ya

Maniphest Tasks: T156

Differential Revision: https://review.inboxapp.com/D247
Don't canonicalize NULL contact email addresses.
Apply query.order_by before applying limit/offset in api/filtering.py

Otherwise the call fails with a sqlalchemy InvalidRequestError. Fixes T159.
Set db pool size in config, and remove unused config values.
Update ImapUid code now that we generate Messages regardless of parse errors.
X-GM-MSGID is unique per account, but not globally.

We had a couple bugs in there where we were making improper assumptions
on how to look up the associated Message object when creating ImapUid
entries for deduplicated Gmail message downloads.
Updating documentation based on Layer meeting feedback

Summary: Only modifies docs

Test Plan: Read over docs and provide feedback

Reviewers: spang

Differential Revision: https://review.inboxapp.com/D242

Conflicts:
	inbox/docs/api/05_tags.mdown
Initial cred checker.

Summary:
[cred-checker] Initial cred-checker script + refactoring.

[cred-checker] live account table.

[cred-checker] Add some logging support.

[cred-checker] test database.

Refs T139

Test Plan: review code

Reviewers: emfree

Reviewed By: emfree

Maniphest Tasks: T139

Differential Revision: https://review.inboxapp.com/D246
Fix migration 053 when email addresses or non-null but not parseable.