net-imap 0.5.10 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,7 +6,6 @@ module Net
6
6
  autoload :FetchData, "#{__dir__}/fetch_data"
7
7
  autoload :UIDFetchData, "#{__dir__}/fetch_data"
8
8
  autoload :SearchResult, "#{__dir__}/search_result"
9
- autoload :UIDPlusData, "#{__dir__}/uidplus_data"
10
9
  autoload :AppendUIDData, "#{__dir__}/uidplus_data"
11
10
  autoload :CopyUIDData, "#{__dir__}/uidplus_data"
12
11
  autoload :VanishedData, "#{__dir__}/vanished_data"
@@ -260,8 +259,8 @@ module Net
260
259
  #
261
260
  # === +UIDPLUS+ extension
262
261
  # See {[RFC4315 §3]}[https://www.rfc-editor.org/rfc/rfc4315#section-3].
263
- # * +APPENDUID+, #data is UIDPlusData. See IMAP#append.
264
- # * +COPYUID+, #data is UIDPlusData. See IMAP#copy.
262
+ # * +APPENDUID+, #data is AppendUIDData. See IMAP#append.
263
+ # * +COPYUID+, #data is CopyUIDData. See IMAP#copy.
265
264
  # * +UIDNOTSTICKY+, #data is +nil+. See IMAP#select.
266
265
  #
267
266
  # === +SEARCHRES+ extension
@@ -2017,24 +2017,19 @@ module Net
2017
2017
  CopyUID(validity, src_uids, dst_uids)
2018
2018
  end
2019
2019
 
2020
- def AppendUID(...) DeprecatedUIDPlus(...) || AppendUIDData.new(...) end
2021
- def CopyUID(...) DeprecatedUIDPlus(...) || CopyUIDData.new(...) end
2022
-
2023
2020
  # TODO: remove this code in the v0.6.0 release
2024
2021
  def DeprecatedUIDPlus(validity, src_uids = nil, dst_uids)
2025
2022
  return unless config.parser_use_deprecated_uidplus_data
2026
- compact_uid_sets = [src_uids, dst_uids].compact
2027
- count = compact_uid_sets.map { _1.count_with_duplicates }.max
2028
- max = config.parser_max_deprecated_uidplus_data_size
2029
- if count <= max
2030
- src_uids &&= src_uids.each_ordered_number.to_a
2031
- dst_uids = dst_uids.each_ordered_number.to_a
2032
- UIDPlusData.new(validity, src_uids, dst_uids)
2033
- elsif config.parser_use_deprecated_uidplus_data != :up_to_max_size
2034
- parse_error("uid-set is too large: %d > %d", count, max)
2035
- end
2023
+ warn("#{Config}#parser_use_deprecated_uidplus_data is ignored " \
2024
+ "since v0.6.0. Disable this warning by setting " \
2025
+ "config.parser_use_deprecated_uidplus_data = false.",
2026
+ category: :deprecated, uplevel: 9)
2027
+ nil
2036
2028
  end
2037
2029
 
2030
+ def AppendUID(...) DeprecatedUIDPlus(...) || AppendUIDData.new(...) end
2031
+ def CopyUID(...) DeprecatedUIDPlus(...) || CopyUIDData.new(...) end
2032
+
2038
2033
  ADDRESS_REGEXP = /\G
2039
2034
  \( (?: NIL | #{Patterns::QUOTED_rev2} ) # 1: NAME
2040
2035
  \s (?: NIL | #{Patterns::QUOTED_rev2} ) # 2: ROUTE
@@ -7,6 +7,12 @@ module Net
7
7
  # identifiers returned by Net::IMAP#uid_search.
8
8
  #
9
9
  # For backward compatibility, SearchResult inherits from Array.
10
+ #
11
+ # ==== Compatibility with ESearchResult
12
+ #
13
+ # Note that both SearchResult and ESearchResult implement +each+, +to_a+,
14
+ # and +to_sequence_set+. These methods can be used regardless of whether
15
+ # the server returns +SEARCH+ or +ESEARCH+ data (or no data).
10
16
  class SearchResult < Array
11
17
 
12
18
  # Returns a SearchResult populated with the given +seq_nums+.
@@ -60,9 +66,8 @@ module Net
60
66
  # [3, 5, 7] == Net::IMAP::SearchResult[3, 5, 7, modseq: 99] # => true
61
67
  #
62
68
  def ==(other)
63
- (modseq ?
64
- other.is_a?(self.class) && modseq == other.modseq :
65
- other.is_a?(Array)) &&
69
+ other.is_a?(Array) &&
70
+ modseq == (other.modseq if other.respond_to?(:modseq)) &&
66
71
  size == other.size &&
67
72
  sort == other.sort
68
73
  end