-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔀 Merge pull request #329 from nevans/vanished
✨ Add support for VANISHED responses
- Loading branch information
Showing
7 changed files
with
318 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# frozen_string_literal: true | ||
|
||
module Net | ||
class IMAP < Protocol | ||
|
||
# Net::IMAP::VanishedData represents the contents of a +VANISHED+ response, | ||
# which is described by the | ||
# {QRESYNC}[https://www.rfc-editor.org/rfc/rfc7162.html] extension. | ||
# [{RFC7162 §3.2.10}[https://www.rfc-editor.org/rfc/rfc7162.html#section-3.2.10]]. | ||
# | ||
# +VANISHED+ responses replace +EXPUNGE+ responses when either the | ||
# {QRESYNC}[https://www.rfc-editor.org/rfc/rfc7162.html] or the | ||
# {UIDONLY}[https://www.rfc-editor.org/rfc/rfc9586.html] extension has been | ||
# enabled. | ||
class VanishedData < Data.define(:uids, :earlier) | ||
|
||
# Returns a new VanishedData object. | ||
# | ||
# * +uids+ will be converted by SequenceSet.[]. | ||
# * +earlier+ will be converted to +true+ or +false+ | ||
def initialize(uids:, earlier:) | ||
uids = SequenceSet[uids] | ||
earlier = !!earlier | ||
super | ||
end | ||
|
||
## | ||
# :attr_reader: uids | ||
# | ||
# SequenceSet of UIDs that have been permanently removed from the mailbox. | ||
|
||
## | ||
# :attr_reader: earlier | ||
# | ||
# +true+ when the response was caused by Net::IMAP#uid_fetch with | ||
# <tt>vanished: true</tt> or Net::IMAP#select/Net::IMAP#examine with | ||
# <tt>qresync: true</tt>. | ||
# | ||
# +false+ when the response is used to announce message removals within an | ||
# already selected mailbox. | ||
|
||
# rdoc doesn't handle attr aliases nicely. :( | ||
alias earlier? earlier # :nodoc: | ||
## | ||
# :attr_reader: earlier? | ||
# | ||
# Alias for #earlier. | ||
|
||
# Returns an Array of all of the UIDs in #uids. | ||
# | ||
# See SequenceSet#numbers. | ||
def to_a; uids.numbers end | ||
|
||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.