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 VANISHED responses #329

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

Conversation

nevans
Copy link
Collaborator

@nevans nevans commented Sep 25, 2024

VANISHED responses are required by two different extensions: QRESYNC and UIDONLY.

  • Add a new response data type: VanishedData, which wraps SequenceSet and the EARLIER modifier.
  • Update the parser to handle the VANISHED response => VanishedData
  • Update #expunge and #uid_expunge to return VANISHED (without the EARLIER modifier) responses, when they are present.
    • There is a TODO note on this: For consistency, if either of the above extensions are enabled, we should return an empty VanishedResponse when the commands have no result. Currently, an empty array is returned.

Although neither extension is completely supported yet, they can both be (partially) used in a way that doesn't crash... so I think this is a reasonable chunk to extract into its own PR, rather than wait for a PR for either of them to be 100% ready.

@nevans
Copy link
Collaborator Author

nevans commented Sep 25, 2024

Note that this PR is based on #330.

nevans and others added 4 commits November 11, 2024 11:01
For new data structs, I'd prefer frozen by default and I don't want to
support the entire Struct API.  Data is perfect, but it's not available
until ruby 3.2.

So this adds a DataLite class that closely matches ruby 3.2's Data
class, and it can be a drop-in replacement for Data.  Net::IMAP::Data
is an alias for Net::IMAP::DataLite, so when we remove our
implementation, the constant will resolve to ruby's ::Data.

Ideally, we wouldn't define this on newer ruby versions at all, but that
breaks the YAML serialization for our test fixtures.

The tests (and some of the implementation) have been copied from the
polyfill-data gem and updated so that they use "Data" as it is resolved
inside the "Net::IMAP" namespace.  Copyright notices have been added to
the appropriate files to satisfy the MIT license terms.

Co-authored-by: Jim Gay <[email protected]>
This updates the parser to handle the VANISHED response, and adds a new
response data class: VanishedData.

VanishedData was originally written as a plain class and then converted
to Data.  I'm keeping most of the tests that I wrote prior to converting
it to Data, but I probably wouldn't have written many of them if I had
used Data in the first place.
Both the `QRESYNC` and `UIDONLY` extensions replace `EXPUNGE` responses
with `VANISHED` responses.  This updates the #expunge and #uid_expunge
commands to return VanishedData, rather than a (misleading) empty array.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant