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 support for RFC7162 (QRESYNC) VANISHED response. #101

Merged
merged 1 commit into from
Nov 10, 2020

Conversation

mordak
Copy link
Contributor

@mordak mordak commented Nov 9, 2020

RFC7162 defines a VANISHED response to the EXPUNGE command which must be used whenever a client has enabled QRESYNC. VANISHED may also appear in response to SELECT/EXAMINE or UID FETCH.

https://tools.ietf.org/html/rfc7162#section-3.2.10

The VANISHED response sends a sequence set of UIDs indicating UIDs which have been deleted from the mailbox.

I had to add parsers for sequence-range (eg 15:30) and sequence-set (eg. 1,10:20,25,28:31), and I put them in core.rs since they are actually defined in RFC 3501 and show up in a couple of other places, so may be generically useful.

I am not sure if the choice to return a Vec<RangeInclusive> is to your liking. Alternatives could be just a tuple of (start, end), or expand the range out into a big list of Vec<u32>. I experimented with both options and settled on the Vec<RangeInclusive> because:

  • It is literally how the spec defines them
  • It is impossible to misinterpret, whereas a user would need to read the RFC to know (start, end) is inclusive
  • It is efficient in that large ranges can be represented and iterated with low memory overhead.

The downside is it can be a bit awkward to use, since you end up iterating a list of iterators. Of course, the nicest way to represent this for the user is to expand the sequence set out into a Vec<u32>, but this could be wasteful / dangerous in some circumstances.

@djc djc merged commit ed629aa into djc:main Nov 10, 2020
@djc
Copy link
Owner

djc commented Nov 10, 2020

This is great, thanks! Would it be helpful to get a release including this?

@mordak
Copy link
Contributor Author

mordak commented Nov 11, 2020

Would it be helpful to get a release including this?

A release including this would be helpful, yes! :-)

@djc
Copy link
Owner

djc commented Nov 11, 2020

0.12.0 is out now.

@mordak
Copy link
Contributor Author

mordak commented Nov 11, 2020

0.12.0 is out now.

Thank you! Just opened the domino PR for rust-imap: jonhoo/rust-imap#172

And then my IMAP <-> Maildir sync engine will actually build against public crates!

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.

2 participants