net-imap 0.5.2 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of net-imap might be problematic. Click here for more details.

@@ -321,6 +321,24 @@ module Net
321
321
  SEQUENCE_SET = /#{SEQUENCE_SET_ITEM}(?:,#{SEQUENCE_SET_ITEM})*/n
322
322
  SEQUENCE_SET_STR = /\A#{SEQUENCE_SET}\z/n
323
323
 
324
+ # partial-range-first = nz-number ":" nz-number
325
+ # ;; Request to search from oldest (lowest UIDs) to
326
+ # ;; more recent messages.
327
+ # ;; A range 500:400 is the same as 400:500.
328
+ # ;; This is similar to <seq-range> from [RFC3501]
329
+ # ;; but cannot contain "*".
330
+ PARTIAL_RANGE_FIRST = /\A(#{NZ_NUMBER}):(#{NZ_NUMBER})\z/n
331
+
332
+ # partial-range-last = MINUS nz-number ":" MINUS nz-number
333
+ # ;; Request to search from newest (highest UIDs) to
334
+ # ;; oldest messages.
335
+ # ;; A range -500:-400 is the same as -400:-500.
336
+ PARTIAL_RANGE_LAST = /\A(-#{NZ_NUMBER}):(-#{NZ_NUMBER})\z/n
337
+
338
+ # partial-range = partial-range-first / partial-range-last
339
+ PARTIAL_RANGE = Regexp.union(PARTIAL_RANGE_FIRST,
340
+ PARTIAL_RANGE_LAST)
341
+
324
342
  # RFC3501:
325
343
  # literal = "{" number "}" CRLF *CHAR8
326
344
  # ; Number represents the number of CHAR8s
@@ -716,7 +734,7 @@ module Net
716
734
  when "EXISTS" then mailbox_data__exists # RFC3501, RFC9051
717
735
  when "ESEARCH" then esearch_response # RFC4731, RFC9051, etc
718
736
  when "VANISHED" then expunged_resp # RFC7162
719
- when "UIDFETCH" then uidfetch_resp # (draft) UIDONLY
737
+ when "UIDFETCH" then uidfetch_resp # RFC9586
720
738
  when "SEARCH" then mailbox_data__search # RFC3501 (obsolete)
721
739
  when "CAPABILITY" then capability_data__untagged # RFC3501, RFC9051
722
740
  when "FLAGS" then mailbox_data__flags # RFC3501, RFC9051
@@ -769,8 +787,6 @@ module Net
769
787
  def response_data__ignored; response_data__unhandled(IgnoredResponse) end
770
788
  alias response_data__noop response_data__ignored
771
789
 
772
- alias expunged_resp response_data__unhandled
773
- alias uidfetch_resp response_data__unhandled
774
790
  alias listrights_data response_data__unhandled
775
791
  alias myrights_data response_data__unhandled
776
792
  alias metadata_resp response_data__unhandled
@@ -831,6 +847,14 @@ module Net
831
847
  UntaggedResponse.new(name, data, @str)
832
848
  end
833
849
 
850
+ # uidfetch-resp = uniqueid SP "UIDFETCH" SP msg-att
851
+ def uidfetch_resp
852
+ uid = uniqueid; SP!
853
+ name = label "UIDFETCH"; SP!
854
+ data = UIDFetchData.new(uid, msg_att(uid))
855
+ UntaggedResponse.new(name, data, @str)
856
+ end
857
+
834
858
  def response_data__simple_numeric
835
859
  data = nz_number; SP!
836
860
  name = tagged_ext_label
@@ -841,6 +865,20 @@ module Net
841
865
  alias mailbox_data__exists response_data__simple_numeric
842
866
  alias mailbox_data__recent response_data__simple_numeric
843
867
 
868
+ # The name for this is confusing, because it *replaces* EXPUNGE
869
+ # >>>
870
+ # expunged-resp = "VANISHED" [SP "(EARLIER)"] SP known-uids
871
+ def expunged_resp
872
+ name = label "VANISHED"; SP!
873
+ earlier = if lpar? then label("EARLIER"); rpar; SP!; true else false end
874
+ uids = known_uids
875
+ data = VanishedData[uids, earlier]
876
+ UntaggedResponse.new name, data, @str
877
+ end
878
+
879
+ # TODO: replace with uid_set
880
+ alias known_uids sequence_set
881
+
844
882
  # RFC3501 & RFC9051:
845
883
  # msg-att = "(" (msg-att-dynamic / msg-att-static)
846
884
  # *(SP (msg-att-dynamic / msg-att-static)) ")"
@@ -1504,6 +1542,9 @@ module Net
1504
1542
  # From RFC4731 (ESEARCH):
1505
1543
  # search-return-data =/ "MODSEQ" SP mod-sequence-value
1506
1544
  #
1545
+ # From RFC9394 (PARTIAL):
1546
+ # search-return-data =/ ret-data-partial
1547
+ #
1507
1548
  def search_return_data
1508
1549
  label = search_modifier_name; SP!
1509
1550
  value =
@@ -1513,11 +1554,41 @@ module Net
1513
1554
  when "ALL" then sequence_set
1514
1555
  when "COUNT" then number
1515
1556
  when "MODSEQ" then mod_sequence_value # RFC7162: CONDSTORE
1557
+ when "PARTIAL" then ret_data_partial__value # RFC9394: PARTIAL
1516
1558
  else search_return_value
1517
1559
  end
1518
1560
  [label, value]
1519
1561
  end
1520
1562
 
1563
+ # From RFC5267 (CONTEXT=SEARCH, CONTEXT=SORT) and RFC9394 (PARTIAL):
1564
+ # ret-data-partial = "PARTIAL"
1565
+ # SP "(" partial-range SP partial-results ")"
1566
+ def ret_data_partial__value
1567
+ lpar
1568
+ range = partial_range; SP!
1569
+ results = partial_results
1570
+ rpar
1571
+ ESearchResult::PartialResult.new(range, results)
1572
+ end
1573
+
1574
+ # partial-range = partial-range-first / partial-range-last
1575
+ # tagged-ext-simple =/ partial-range-last
1576
+ def partial_range
1577
+ case (str = atom)
1578
+ when Patterns::PARTIAL_RANGE_FIRST, Patterns::PARTIAL_RANGE_LAST
1579
+ min, max = [Integer($1), Integer($2)].minmax
1580
+ min..max
1581
+ else
1582
+ parse_error("unexpected atom %p, expected partial-range", str)
1583
+ end
1584
+ end
1585
+
1586
+ # partial-results = sequence-set / "NIL"
1587
+ # ;; <sequence-set> from [RFC3501].
1588
+ # ;; NIL indicates that no results correspond to
1589
+ # ;; the requested range.
1590
+ def partial_results; NIL? ? nil : sequence_set end
1591
+
1521
1592
  # search-modifier-name = tagged-ext-label
1522
1593
  alias search_modifier_name tagged_ext_label
1523
1594
 
@@ -1871,6 +1942,9 @@ module Net
1871
1942
  #
1872
1943
  # RFC8474: OBJECTID
1873
1944
  # resp-text-code =/ "MAILBOXID" SP "(" objectid ")"
1945
+ #
1946
+ # RFC9586: UIDONLY
1947
+ # resp-text-code =/ "UIDREQUIRED"
1874
1948
  def resp_text_code
1875
1949
  name = resp_text_code__name
1876
1950
  data =
@@ -1893,6 +1967,7 @@ module Net
1893
1967
  when "HIGHESTMODSEQ" then SP!; mod_sequence_value # CONDSTORE
1894
1968
  when "MODIFIED" then SP!; sequence_set # CONDSTORE
1895
1969
  when "MAILBOXID" then SP!; parens__objectid # RFC8474: OBJECTID
1970
+ when "UIDREQUIRED" then # RFC9586: UIDONLY
1896
1971
  else
1897
1972
  SP? and text_chars_except_rbra
1898
1973
  end
@@ -5,7 +5,7 @@ module Net
5
5
  module SASL
6
6
 
7
7
  # Authenticator for the "+ANONYMOUS+" SASL mechanism, as specified by
8
- # RFC-4505[https://tools.ietf.org/html/rfc4505]. See
8
+ # RFC-4505[https://www.rfc-editor.org/rfc/rfc4505]. See
9
9
  # Net::IMAP#authenticate.
10
10
  class AnonymousAuthenticator
11
11
 
@@ -13,7 +13,7 @@ module Net
13
13
  # characters in length.
14
14
  #
15
15
  # If it contains an "@" sign, the message must be a valid email address
16
- # (+addr-spec+ from RFC-2822[https://tools.ietf.org/html/rfc2822]).
16
+ # (+addr-spec+ from RFC-2822[https://www.rfc-editor.org/rfc/rfc2822]).
17
17
  # Email syntax is _not_ validated by AnonymousAuthenticator.
18
18
  #
19
19
  # Otherwise, it can be any UTF8 string which is permitted by the
@@ -25,7 +25,7 @@ module Net
25
25
  # new(anonymous_message: "", **) -> authenticator
26
26
  #
27
27
  # Creates an Authenticator for the "+ANONYMOUS+" SASL mechanism, as
28
- # specified in RFC-4505[https://tools.ietf.org/html/rfc4505]. To use
28
+ # specified in RFC-4505[https://www.rfc-editor.org/rfc/rfc4505]. To use
29
29
  # this, see Net::IMAP#authenticate or your client's authentication
30
30
  # method.
31
31
  #
@@ -1,16 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Authenticator for the "+CRAM-MD5+" SASL mechanism, specified in
4
- # RFC2195[https://tools.ietf.org/html/rfc2195]. See Net::IMAP#authenticate.
4
+ # RFC2195[https://www.rfc-editor.org/rfc/rfc2195]. See Net::IMAP#authenticate.
5
5
  #
6
6
  # == Deprecated
7
7
  #
8
8
  # +CRAM-MD5+ is obsolete and insecure. It is included for compatibility with
9
9
  # existing servers.
10
- # {draft-ietf-sasl-crammd5-to-historic}[https://tools.ietf.org/html/draft-ietf-sasl-crammd5-to-historic-00.html]
10
+ # {draft-ietf-sasl-crammd5-to-historic}[https://www.rfc-editor.org/rfc/draft-ietf-sasl-crammd5-to-historic-00.html]
11
11
  # recommends using +SCRAM-*+ or +PLAIN+ protected by TLS instead.
12
12
  #
13
- # Additionally, RFC8314[https://tools.ietf.org/html/rfc8314] discourage the use
13
+ # Additionally, RFC8314[https://www.rfc-editor.org/rfc/rfc8314] discourage the use
14
14
  # of cleartext and recommends TLS version 1.2 or greater be used for all
15
15
  # traffic. With TLS +CRAM-MD5+ is okay, but so is +PLAIN+
16
16
  class Net::IMAP::SASL::CramMD5Authenticator
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Net::IMAP authenticator for the +DIGEST-MD5+ SASL mechanism type, specified
4
- # in RFC-2831[https://tools.ietf.org/html/rfc2831]. See Net::IMAP#authenticate.
4
+ # in RFC-2831[https://www.rfc-editor.org/rfc/rfc2831]. See Net::IMAP#authenticate.
5
5
  #
6
6
  # == Deprecated
7
7
  #
8
8
  # "+DIGEST-MD5+" has been deprecated by
9
- # RFC-6331[https://tools.ietf.org/html/rfc6331] and should not be relied on for
9
+ # RFC-6331[https://www.rfc-editor.org/rfc/rfc6331] and should not be relied on for
10
10
  # security. It is included for compatibility with existing servers.
11
11
  class Net::IMAP::SASL::DigestMD5Authenticator
12
12
  DataFormatError = Net::IMAP::DataFormatError
@@ -37,10 +37,10 @@ class Net::IMAP::SASL::DigestMD5Authenticator
37
37
 
38
38
  # Authentication identity: the identity that matches the #password.
39
39
  #
40
- # RFC-2831[https://tools.ietf.org/html/rfc2831] uses the term +username+.
40
+ # RFC-2831[https://www.rfc-editor.org/rfc/rfc2831] uses the term +username+.
41
41
  # "Authentication identity" is the generic term used by
42
- # RFC-4422[https://tools.ietf.org/html/rfc4422].
43
- # RFC-4616[https://tools.ietf.org/html/rfc4616] and many later RFCs abbreviate
42
+ # RFC-4422[https://www.rfc-editor.org/rfc/rfc4422].
43
+ # RFC-4616[https://www.rfc-editor.org/rfc/rfc4616] and many later RFCs abbreviate
44
44
  # this to +authcid+.
45
45
  attr_reader :username
46
46
  alias authcid username
@@ -85,7 +85,7 @@ class Net::IMAP::SASL::DigestMD5Authenticator
85
85
  # must be set appropriately to use authenticators in other protocols.
86
86
  #
87
87
  # If an IANA-registered name isn't available, GSS-API
88
- # (RFC-2743[https://tools.ietf.org/html/rfc2743]) allows the generic name
88
+ # (RFC-2743[https://www.rfc-editor.org/rfc/rfc2743]) allows the generic name
89
89
  # "host".
90
90
  attr_reader :service
91
91
 
@@ -93,7 +93,7 @@ class Net::IMAP::SASL::DigestMD5Authenticator
93
93
  #
94
94
  # +service_name+ will be ignored when it is +nil+ or identical to +host+.
95
95
  #
96
- # From RFC-2831[https://tools.ietf.org/html/rfc2831]:
96
+ # From RFC-2831[https://www.rfc-editor.org/rfc/rfc2831]:
97
97
  # >>>
98
98
  # The service is considered to be replicated if the client's
99
99
  # service-location process involves resolution using standard DNS lookup
@@ -176,7 +176,7 @@ class Net::IMAP::SASL::DigestMD5Authenticator
176
176
  @nc, @stage = {}, STAGE_ONE
177
177
  end
178
178
 
179
- # From RFC-2831[https://tools.ietf.org/html/rfc2831]:
179
+ # From RFC-2831[https://www.rfc-editor.org/rfc/rfc2831]:
180
180
  # >>>
181
181
  # Indicates the principal name of the service with which the client wishes
182
182
  # to connect, formed from the serv-type, host, and serv-name. For
@@ -5,7 +5,7 @@ module Net
5
5
  module SASL
6
6
 
7
7
  # Authenticator for the "+EXTERNAL+" SASL mechanism, as specified by
8
- # RFC-4422[https://tools.ietf.org/html/rfc4422]. See
8
+ # RFC-4422[https://www.rfc-editor.org/rfc/rfc4422]. See
9
9
  # Net::IMAP#authenticate.
10
10
  #
11
11
  # The EXTERNAL mechanism requests that the server use client credentials
@@ -33,7 +33,7 @@ module Net
33
33
  # new(username = nil, **) -> authenticator
34
34
  #
35
35
  # Creates an Authenticator for the "+EXTERNAL+" SASL mechanism, as
36
- # specified in RFC-4422[https://tools.ietf.org/html/rfc4422]. To use
36
+ # specified in RFC-4422[https://www.rfc-editor.org/rfc/rfc4422]. To use
37
37
  # this, see Net::IMAP#authenticate or your client's authentication
38
38
  # method.
39
39
  #
@@ -5,15 +5,15 @@ module Net
5
5
  module SASL
6
6
 
7
7
  # Originally defined for the GS2 mechanism family in
8
- # RFC5801[https://tools.ietf.org/html/rfc5801],
8
+ # RFC5801[https://www.rfc-editor.org/rfc/rfc5801],
9
9
  # several different mechanisms start with a GS2 header:
10
- # * +GS2-*+ --- RFC5801[https://tools.ietf.org/html/rfc5801]
11
- # * +SCRAM-*+ --- RFC5802[https://tools.ietf.org/html/rfc5802]
10
+ # * +GS2-*+ --- RFC5801[https://www.rfc-editor.org/rfc/rfc5801]
11
+ # * +SCRAM-*+ --- RFC5802[https://www.rfc-editor.org/rfc/rfc5802]
12
12
  # (ScramAuthenticator)
13
- # * +SAML20+ --- RFC6595[https://tools.ietf.org/html/rfc6595]
14
- # * +OPENID20+ --- RFC6616[https://tools.ietf.org/html/rfc6616]
15
- # * +OAUTH10A+ --- RFC7628[https://tools.ietf.org/html/rfc7628]
16
- # * +OAUTHBEARER+ --- RFC7628[https://tools.ietf.org/html/rfc7628]
13
+ # * +SAML20+ --- RFC6595[https://www.rfc-editor.org/rfc/rfc6595]
14
+ # * +OPENID20+ --- RFC6616[https://www.rfc-editor.org/rfc/rfc6616]
15
+ # * +OAUTH10A+ --- RFC7628[https://www.rfc-editor.org/rfc/rfc7628]
16
+ # * +OAUTHBEARER+ --- RFC7628[https://www.rfc-editor.org/rfc/rfc7628]
17
17
  # (OAuthBearerAuthenticator)
18
18
  #
19
19
  # Classes that include this module must implement +#authzid+.
@@ -3,9 +3,9 @@
3
3
  # Authenticator for the "+LOGIN+" SASL mechanism. See Net::IMAP#authenticate.
4
4
  #
5
5
  # +LOGIN+ authentication sends the password in cleartext.
6
- # RFC3501[https://tools.ietf.org/html/rfc3501] encourages servers to disable
6
+ # RFC3501[https://www.rfc-editor.org/rfc/rfc3501] encourages servers to disable
7
7
  # cleartext authentication until after TLS has been negotiated.
8
- # RFC8314[https://tools.ietf.org/html/rfc8314] recommends TLS version 1.2 or
8
+ # RFC8314[https://www.rfc-editor.org/rfc/rfc8314] recommends TLS version 1.2 or
9
9
  # greater be used for all traffic, and deprecate cleartext access ASAP. +LOGIN+
10
10
  # can be secured by TLS encryption.
11
11
  #
@@ -7,7 +7,7 @@ module Net
7
7
  module SASL
8
8
 
9
9
  # Abstract base class for the SASL mechanisms defined in
10
- # RFC7628[https://tools.ietf.org/html/rfc7628]:
10
+ # RFC7628[https://www.rfc-editor.org/rfc/rfc7628]:
11
11
  # * OAUTHBEARER[rdoc-ref:OAuthBearerAuthenticator]
12
12
  # (OAuthBearerAuthenticator)
13
13
  # * OAUTH10A
@@ -52,7 +52,7 @@ module Net
52
52
  # this may hold information about the failure reason, as JSON.
53
53
  attr_reader :last_server_response
54
54
 
55
- # Creates an RFC7628[https://tools.ietf.org/html/rfc7628] OAuth
55
+ # Creates an RFC7628[https://www.rfc-editor.org/rfc/rfc7628] OAuth
56
56
  # authenticator.
57
57
  #
58
58
  # ==== Parameters
@@ -126,12 +126,12 @@ module Net
126
126
  end
127
127
 
128
128
  # Authenticator for the "+OAUTHBEARER+" SASL mechanism, specified in
129
- # RFC7628[https://tools.ietf.org/html/rfc7628]. Authenticates using OAuth
130
- # 2.0 bearer tokens, as described in
131
- # RFC6750[https://tools.ietf.org/html/rfc6750]. Use via
129
+ # RFC7628[https://www.rfc-editor.org/rfc/rfc7628]. Authenticates using
130
+ # OAuth 2.0 bearer tokens, as described in
131
+ # RFC6750[https://www.rfc-editor.org/rfc/rfc6750]. Use via
132
132
  # Net::IMAP#authenticate.
133
133
  #
134
- # RFC6750[https://tools.ietf.org/html/rfc6750] requires Transport Layer
134
+ # RFC6750[https://www.rfc-editor.org/rfc/rfc6750] requires Transport Layer
135
135
  # Security (TLS) to secure the protocol interaction between the client and
136
136
  # the resource server. TLS _MUST_ be used for +OAUTHBEARER+ to protect
137
137
  # the bearer token.
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Authenticator for the "+PLAIN+" SASL mechanism, specified in
4
- # RFC-4616[https://tools.ietf.org/html/rfc4616]. See Net::IMAP#authenticate.
4
+ # RFC-4616[https://www.rfc-editor.org/rfc/rfc4616]. See Net::IMAP#authenticate.
5
5
  #
6
6
  # +PLAIN+ authentication sends the password in cleartext.
7
- # RFC-3501[https://tools.ietf.org/html/rfc3501] encourages servers to disable
7
+ # RFC-3501[https://www.rfc-editor.org/rfc/rfc3501] encourages servers to disable
8
8
  # cleartext authentication until after TLS has been negotiated.
9
- # RFC-8314[https://tools.ietf.org/html/rfc8314] recommends TLS version 1.2 or
9
+ # RFC-8314[https://www.rfc-editor.org/rfc/rfc8314] recommends TLS version 1.2 or
10
10
  # greater be used for all traffic, and deprecate cleartext access ASAP. +PLAIN+
11
11
  # can be secured by TLS encryption.
12
12
  class Net::IMAP::SASL::PlainAuthenticator
@@ -16,11 +16,11 @@ class Net::IMAP::SASL::PlainAuthenticator
16
16
 
17
17
  # Authentication identity: the identity that matches the #password.
18
18
  #
19
- # RFC-2831[https://tools.ietf.org/html/rfc2831] uses the term +username+.
19
+ # RFC-2831[https://www.rfc-editor.org/rfc/rfc2831] uses the term +username+.
20
20
  # "Authentication identity" is the generic term used by
21
- # RFC-4422[https://tools.ietf.org/html/rfc4422].
22
- # RFC-4616[https://tools.ietf.org/html/rfc4616] and many later RFCs abbreviate
23
- # this to +authcid+.
21
+ # RFC-4422[https://www.rfc-editor.org/rfc/rfc4422].
22
+ # RFC-4616[https://www.rfc-editor.org/rfc/rfc4616] and many later RFCs
23
+ # abbreviate this to +authcid+.
24
24
  attr_reader :username
25
25
  alias authcid username
26
26
 
@@ -11,7 +11,7 @@ module Net
11
11
  module SASL
12
12
 
13
13
  # Abstract base class for the "+SCRAM-*+" family of SASL mechanisms,
14
- # defined in RFC5802[https://tools.ietf.org/html/rfc5802]. Use via
14
+ # defined in RFC5802[https://www.rfc-editor.org/rfc/rfc5802]. Use via
15
15
  # Net::IMAP#authenticate.
16
16
  #
17
17
  # Directly supported:
@@ -99,11 +99,11 @@ module Net
99
99
 
100
100
  # Authentication identity: the identity that matches the #password.
101
101
  #
102
- # RFC-2831[https://tools.ietf.org/html/rfc2831] uses the term +username+.
103
- # "Authentication identity" is the generic term used by
104
- # RFC-4422[https://tools.ietf.org/html/rfc4422].
105
- # RFC-4616[https://tools.ietf.org/html/rfc4616] and many later RFCs abbreviate
106
- # this to +authcid+.
102
+ # RFC-2831[https://www.rfc-editor.org/rfc/rfc2831] uses the term
103
+ # +username+. "Authentication identity" is the generic term used by
104
+ # RFC-4422[https://www.rfc-editor.org/rfc/rfc4422].
105
+ # RFC-4616[https://www.rfc-editor.org/rfc/rfc4616] and many later RFCs
106
+ # abbreviate this to +authcid+.
107
107
  attr_reader :username
108
108
  alias authcid username
109
109
 
@@ -263,7 +263,7 @@ module Net
263
263
  end
264
264
 
265
265
  # Authenticator for the "+SCRAM-SHA-1+" SASL mechanism, defined in
266
- # RFC5802[https://tools.ietf.org/html/rfc5802].
266
+ # RFC5802[https://www.rfc-editor.org/rfc/rfc5802].
267
267
  #
268
268
  # Uses the "SHA-1" digest algorithm from OpenSSL::Digest.
269
269
  #
@@ -273,7 +273,7 @@ module Net
273
273
  end
274
274
 
275
275
  # Authenticator for the "+SCRAM-SHA-256+" SASL mechanism, defined in
276
- # RFC7677[https://tools.ietf.org/html/rfc7677].
276
+ # RFC7677[https://www.rfc-editor.org/rfc/rfc7677].
277
277
  #
278
278
  # Uses the "SHA-256" digest algorithm from OpenSSL::Digest.
279
279
  #
data/lib/net/imap/sasl.rb CHANGED
@@ -5,7 +5,7 @@ module Net
5
5
 
6
6
  # Pluggable authentication mechanisms for protocols which support SASL
7
7
  # (Simple Authentication and Security Layer), such as IMAP4, SMTP, LDAP, and
8
- # XMPP. {RFC-4422}[https://tools.ietf.org/html/rfc4422] specifies the
8
+ # XMPP. {RFC-4422}[https://www.rfc-editor.org/rfc/rfc4422] specifies the
9
9
  # common \SASL framework:
10
10
  # >>>
11
11
  # SASL is conceptually a framework that provides an abstraction layer
@@ -100,10 +100,10 @@ module Net
100
100
  # data.to_s("SORT") # => "* SORT 2 8 32 128 256 512"
101
101
  # data.to_s(nil) # => "2 8 32 128 256 512"
102
102
  #
103
- # data = Net::IMAP::SearchResult[1, 3, 16, 1024, modseq: 2048].to_s
103
+ # data = Net::IMAP::SearchResult[1, 3, 16, 1024, modseq: 2048]
104
104
  # data.to_s # => "* SEARCH 1 3 16 1024 (MODSEQ 2048)"
105
105
  # data.to_s("SORT") # => "* SORT 1 3 16 1024 (MODSEQ 2048)"
106
- # data.to_s # => "1 3 16 1024 (MODSEQ 2048)"
106
+ # data.to_s(nil) # => "1 3 16 1024 (MODSEQ 2048)"
107
107
  #
108
108
  def to_s(type = "SEARCH")
109
109
  str = +""
@@ -4,7 +4,7 @@ module Net
4
4
  class IMAP
5
5
  module StringPrep
6
6
 
7
- # Defined in RFC3491[https://tools.ietf.org/html/rfc3491], the +nameprep+
7
+ # Defined in RFC3491[https://www.rfc-editor.org/rfc/rfc3491], the +nameprep+
8
8
  # profile of "Stringprep" is:
9
9
  # >>>
10
10
  # used by the IDNA protocol for preparing domain names; it is not
@@ -4,11 +4,11 @@ module Net
4
4
  class IMAP
5
5
  module StringPrep
6
6
 
7
- # Defined in RFC-4505[https://tools.ietf.org/html/rfc4505] §3, The +trace+
7
+ # Defined in RFC-4505[https://www.rfc-editor.org/rfc/rfc4505] §3, The +trace+
8
8
  # profile of \StringPrep is used by the +ANONYMOUS+ \SASL mechanism.
9
9
  module Trace
10
10
 
11
- # Defined in RFC-4505[https://tools.ietf.org/html/rfc4505] §3.
11
+ # Defined in RFC-4505[https://www.rfc-editor.org/rfc/rfc4505] §3.
12
12
  STRINGPREP_PROFILE = "trace"
13
13
 
14
14
  # >>>
@@ -23,7 +23,7 @@ module Net
23
23
  # No Unicode normalization is required by this profile.
24
24
  NORMALIZATION = nil
25
25
 
26
- # From RFC-4505[https://tools.ietf.org/html/rfc4505] §3, The "trace"
26
+ # From RFC-4505[https://www.rfc-editor.org/rfc/rfc4505] §3, The "trace"
27
27
  # Profile of "Stringprep":
28
28
  # >>>
29
29
  # Characters from the following tables of [StringPrep] are prohibited:
@@ -47,7 +47,7 @@ module Net
47
47
 
48
48
  module_function
49
49
 
50
- # From RFC-4505[https://tools.ietf.org/html/rfc4505] §3, The "trace"
50
+ # From RFC-4505[https://www.rfc-editor.org/rfc/rfc4505] §3, The "trace"
51
51
  # Profile of "Stringprep":
52
52
  # >>>
53
53
  # The character repertoire of this profile is Unicode 3.2 [Unicode].
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Net
4
+ class IMAP < Protocol
5
+
6
+ # Net::IMAP::VanishedData represents the contents of a +VANISHED+ response,
7
+ # which is described by the
8
+ # {QRESYNC}[https://www.rfc-editor.org/rfc/rfc7162.html] extension.
9
+ # [{RFC7162 §3.2.10}[https://www.rfc-editor.org/rfc/rfc7162.html#section-3.2.10]].
10
+ #
11
+ # +VANISHED+ responses replace +EXPUNGE+ responses when either the
12
+ # {QRESYNC}[https://www.rfc-editor.org/rfc/rfc7162.html] or the
13
+ # {UIDONLY}[https://www.rfc-editor.org/rfc/rfc9586.html] extension has been
14
+ # enabled.
15
+ class VanishedData < Data.define(:uids, :earlier)
16
+
17
+ # Returns a new VanishedData object.
18
+ #
19
+ # * +uids+ will be converted by SequenceSet.[].
20
+ # * +earlier+ will be converted to +true+ or +false+
21
+ def initialize(uids:, earlier:)
22
+ uids = SequenceSet[uids]
23
+ earlier = !!earlier
24
+ super
25
+ end
26
+
27
+ ##
28
+ # :attr_reader: uids
29
+ #
30
+ # SequenceSet of UIDs that have been permanently removed from the mailbox.
31
+
32
+ ##
33
+ # :attr_reader: earlier
34
+ #
35
+ # +true+ when the response was caused by Net::IMAP#uid_fetch with
36
+ # <tt>vanished: true</tt> or Net::IMAP#select/Net::IMAP#examine with
37
+ # <tt>qresync: true</tt>.
38
+ #
39
+ # +false+ when the response is used to announce message removals within an
40
+ # already selected mailbox.
41
+
42
+ # rdoc doesn't handle attr aliases nicely. :(
43
+ alias earlier? earlier # :nodoc:
44
+ ##
45
+ # :attr_reader: earlier?
46
+ #
47
+ # Alias for #earlier.
48
+
49
+ # Returns an Array of all of the UIDs in #uids.
50
+ #
51
+ # See SequenceSet#numbers.
52
+ def to_a; uids.numbers end
53
+
54
+ end
55
+ end
56
+ end