gmailgem / gmail

A Rubyesque interface to Gmail, with all the tools you'll need.
Other
397 stars 119 forks source link

Add better specs to IMAP Gmail extension, and fix parsing labels with spaces #179

Closed yn closed 9 years ago

yn commented 9 years ago

This functionality doesn't seem to be getting much use in the wild, because this has been broken for a while and no one's stepped up, but I need it for https://github.com/yn/gmail-splitter, so here goes:

1) This worked when this file looked like the original version mentioned in the comment (https://github.com/oxos/gmail-oauth-thread-stats/blob/master/gmail_imap_extensions_compatibility.rb) but that version didn't parse spaces in labels correctly.

2) The version of imap_extensions.rb prior to this PR claimed to parse spaces correctly, but it had no specs and a gnarly off-by-one error that caused parsing errors and extraneous parens in parsed label names.

3) This PR fixed parsing errors and extraneous parens, and adds tests. The server_response lines in the spec have been copied directly from the wire.

4) The original version referenced in (1) would do the following: If GMail sent down "\Inbox" or "\Important" in a label, it would convert it to a symbol like :Inbox or :Important

5) This PR also restores that functionality.

bootstraponline commented 9 years ago

It'd be nice to rebase out the revert commit so the commit history is clean.

bootstraponline commented 9 years ago

The code looks good to me (once squashed to one commit). :+1:

yn commented 9 years ago

I kept it at 2 commits so that the two separate fixes are clear, but the reverted commit and its respective revert is gone.

bootstraponline commented 9 years ago

Thanks for contributing & adding tests.

bootstraponline commented 9 years ago

This has been released in version 0.6.0 of the gmail gem. Thanks for contributing!