Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from Jul 6, 2015

Conversation

yn
Copy link
Contributor

@yn yn commented Jul 6, 2015

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
Copy link
Member

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

@bootstraponline
Copy link
Member

The code looks good to me (once squashed to one commit). 👍

@yn
Copy link
Contributor Author

yn commented Jul 6, 2015

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 added a commit that referenced this pull request Jul 6, 2015
Add better specs to IMAP Gmail extension, and fix parsing labels with spaces
@bootstraponline bootstraponline merged commit b3629ae into gmailgem:master Jul 6, 2015
@bootstraponline
Copy link
Member

Thanks for contributing & adding tests.

@bootstraponline
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants