net-imap 0.5.0 → 0.5.1

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.

Potentially problematic release.


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

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2c89d97e842bce303df112c3fbc0f048f20a2ff1dbf3b85bb2314ea0d2e207c5
4
- data.tar.gz: 11d6ec196e1e768f61a17b0ce7f385a11eb03e3e92af8ab327ba9a90699ee940
3
+ metadata.gz: cf511b8683c6931cf9ec2d3aa4a55ef634a2cc0e670590a4142d9895594b9191
4
+ data.tar.gz: db4ca0b7230553258e0d81a8a5b5cbed4273e30245200db661145ba430af20d0
5
5
  SHA512:
6
- metadata.gz: ca70e20c3c70f4ca57822f70936546adb3129dd7c0771ef2d054b0356ed4f6a994b7453803cc06bd25ebb37dc0ed10f60b5541bc56749dee38a6126264344599
7
- data.tar.gz: 2921a79dbdab7bd0476d883c18db50150388d587c711270faac99ad4505574a23e6532fe61a4fb48f51c8bddea6641d96f81d9dcbe245b4d4f4542fcc7418566
6
+ metadata.gz: b61a04c6992df7d6ffcf0e5396723966c3f3a5a1c6a596caf413c63d355100c8d2c28096a2261045d52ada4d8e995bba1c4f12864bf65fe1355c331df236eb85
7
+ data.tar.gz: 0bc68ec15c5d53f0f437eab5318bf8cdd428dcdc650a98f66e961658ed361b125e866db2d41954e50ce66de5ec143d108e9135f554bd240ff0d7057724d16416
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "set" unless defined?(::Set)
4
+
3
5
  module Net
4
6
  class IMAP
5
7
 
@@ -280,10 +282,7 @@ module Net
280
282
 
281
283
  # valid inputs for "*"
282
284
  STARS = [:*, ?*, -1].freeze
283
- private_constant :STAR_INT, :STARS
284
-
285
- COERCIBLE = ->{ _1.respond_to? :to_sequence_set }
286
- private_constant :COERCIBLE
285
+ private_constant :STARS
287
286
 
288
287
  class << self
289
288
 
@@ -318,7 +317,7 @@ module Net
318
317
  # raised.
319
318
  def try_convert(obj)
320
319
  return obj if obj.is_a?(SequenceSet)
321
- return nil unless respond_to?(:to_sequence_set)
320
+ return nil unless obj.respond_to?(:to_sequence_set)
322
321
  obj = obj.to_sequence_set
323
322
  return obj if obj.is_a?(SequenceSet)
324
323
  raise DataFormatError, "invalid object returned from to_sequence_set"
@@ -382,6 +381,10 @@ module Net
382
381
  # Related: #valid_string, #normalized_string, #to_s
383
382
  def string; @string ||= normalized_string if valid? end
384
383
 
384
+ # Returns an array with #normalized_string when valid and an empty array
385
+ # otherwise.
386
+ def deconstruct; valid? ? [normalized_string] : [] end
387
+
385
388
  # Assigns a new string to #string and resets #elements to match. It
386
389
  # cannot be set to an empty string—assign +nil+ or use #clear instead.
387
390
  # The string is validated but not normalized.
data/lib/net/imap.rb CHANGED
@@ -719,7 +719,7 @@ module Net
719
719
  # * {IMAP URLAUTH Authorization Mechanism Registry}[https://www.iana.org/assignments/urlauth-authorization-mechanism-registry/urlauth-authorization-mechanism-registry.xhtml]
720
720
  #
721
721
  class IMAP < Protocol
722
- VERSION = "0.5.0"
722
+ VERSION = "0.5.1"
723
723
 
724
724
  # Aliases for supported capabilities, to be used with the #enable command.
725
725
  ENABLE_ALIASES = {
@@ -1929,77 +1929,269 @@ module Net
1929
1929
  end
1930
1930
  end
1931
1931
 
1932
- # Sends a {SEARCH command [IMAP4rev1 §6.4.4]}[https://www.rfc-editor.org/rfc/rfc3501#section-6.4.4]
1933
- # to search the mailbox for messages that match the given searching
1934
- # criteria, and returns message sequence numbers. +keys+ can either be a
1935
- # string holding the entire search string, or a single-dimension array of
1936
- # search keywords and arguments.
1932
+ # :call-seq:
1933
+ # search(criteria, charset = nil) -> result
1937
1934
  #
1938
- # Returns a SearchResult object. SearchResult inherits from Array (for
1935
+ # Sends a {SEARCH command [IMAP4rev1 §6.4.4]}[https://www.rfc-editor.org/rfc/rfc3501#section-6.4.4]
1936
+ # to search the mailbox for messages that match the given search +criteria+,
1937
+ # and returns a SearchResult. SearchResult inherits from Array (for
1939
1938
  # backward compatibility) but adds SearchResult#modseq when the +CONDSTORE+
1940
1939
  # capability has been enabled.
1941
1940
  #
1941
+ # +criteria+ is one or more search keys and their arguments, which may be
1942
+ # provided as an array or a string.
1943
+ # See {"Search criteria"}[rdoc-ref:#search@Search+criteria], below.
1944
+ #
1945
+ # * When +criteria+ is an array, each member is a +SEARCH+ command argument:
1946
+ # * Any SequenceSet sends SequenceSet#valid_string.
1947
+ # These types are converted to SequenceSet for validation and encoding:
1948
+ # * +Set+
1949
+ # * +Range+
1950
+ # * <tt>-1</tt> and +:*+ -- both translate to <tt>*</tt>
1951
+ # * responds to +#to_sequence_set+
1952
+ # * +Array+, when each element is one of the above types, a positive
1953
+ # +Integer+, a sequence-set formatted +String+, or a deeply nested
1954
+ # +Array+ of these same types.
1955
+ # * Any +String+ is sent verbatim when it is a valid \IMAP atom,
1956
+ # and encoded as an \IMAP quoted or literal string otherwise.
1957
+ # * Any other nested +Array+ is encoded as a parenthesized list, to group
1958
+ # multiple search keys (e.g., for use with +OR+ and +NOT+).
1959
+ # * Any other +Integer+ (besides <tt>-1</tt>) will be sent as +#to_s+.
1960
+ # * +Date+ objects will be encoded as an \IMAP date (see ::encode_date).
1961
+ #
1962
+ # * When +criteria+ is a string, it will be sent directly to the server
1963
+ # <em>without any validation or encoding</em>. *WARNING:* This is
1964
+ # vulnerable to injection attacks when external inputs are used.
1965
+ #
1966
+ # +charset+ is the name of the {registered character
1967
+ # set}[https://www.iana.org/assignments/character-sets/character-sets.xhtml]
1968
+ # used by strings in the search +criteria+. When +charset+ isn't specified,
1969
+ # either <tt>"US-ASCII"</tt> or <tt>"UTF-8"</tt> is assumed, depending on
1970
+ # the server's capabilities. +charset+ may be sent inside +criteria+
1971
+ # instead of as a separate argument.
1972
+ #
1942
1973
  # Related: #uid_search
1943
1974
  #
1944
- # ===== Search criteria
1975
+ # ===== For example:
1976
+ #
1977
+ # p imap.search(["SUBJECT", "hello", "NOT", "SEEN"])
1978
+ # #=> [1, 6, 7, 8]
1979
+ #
1980
+ # The following searches send the exact same command to the server:
1981
+ #
1982
+ # # criteria array, charset arg
1983
+ # imap.search(["OR", "UNSEEN", %w(FLAGGED SUBJECT foo)], "UTF-8")
1984
+ # # criteria string, charset arg
1985
+ # imap.search("OR UNSEEN (FLAGGED SUBJECT foo)", "UTF-8")
1986
+ # # criteria array contains charset arg
1987
+ # imap.search([*%w[CHARSET UTF-8], "OR", "UNSEEN", %w(FLAGGED SUBJECT foo)])
1988
+ # # criteria string contains charset arg
1989
+ # imap.search("CHARSET UTF-8 OR UNSEEN (FLAGGED SUBJECT foo)")
1945
1990
  #
1946
- # For a full list of search criteria,
1991
+ # ===== Search keys
1992
+ #
1993
+ # For full definitions of the standard search +criteria+,
1947
1994
  # see [{IMAP4rev1 §6.4.4}[https://www.rfc-editor.org/rfc/rfc3501.html#section-6.4.4]],
1948
1995
  # or [{IMAP4rev2 §6.4.4}[https://www.rfc-editor.org/rfc/rfc9051.html#section-6.4.4]],
1949
1996
  # in addition to documentation for
1950
- # any [CAPABILITIES[https://www.iana.org/assignments/imap-capabilities/imap-capabilities.xhtml]]
1951
- # reported by #capabilities which may define additional search filters, e.g:
1997
+ # any #capabilities which may define additional search filters, such as
1952
1998
  # +CONDSTORE+, +WITHIN+, +FILTERS+, <tt>SEARCH=FUZZY</tt>, +OBJECTID+, or
1953
- # +SAVEDATE+. The following are some common search criteria:
1999
+ # +SAVEDATE+.
2000
+ #
2001
+ # With the exception of <em>sequence-set</em> and <em>parenthesized
2002
+ # list</em>, all search keys are composed of prefix label with zero or more
2003
+ # arguments. The number and type of arguments is specific to each search
2004
+ # key.
2005
+ #
2006
+ # +ALL+::
2007
+ # Matches every message in the mailbox.
2008
+ #
2009
+ # (_search-key_ _search-key_...)::
2010
+ # Combines one or more _search-key_ arguments to match
2011
+ # messages which match all contained search keys. Useful for +OR+, +NOT+,
2012
+ # and other search keys with _search-key_ arguments.
2013
+ #
2014
+ # _Note:_ this search key has no label.
2015
+ #
2016
+ # +OR+ _search-key_ _search-key_::
2017
+ # Matches messages which match either _search-key_ argument.
2018
+ #
2019
+ # +NOT+ _search-key_::
2020
+ # Matches messages which do not match _search-key_.
2021
+ #
2022
+ # _sequence-set_::
2023
+ # Matches messages with message sequence numbers in _sequence-set_.
2024
+ #
2025
+ # _Note:_ this search key has no label.
2026
+ #
2027
+ # <em>+UIDONLY+ must *not* be enabled.</em>
2028
+ # {[RFC9586]}[https://www.rfc-editor.org/rfc/rfc9586.html]
2029
+ #
2030
+ # +UID+ _sequence-set_::
2031
+ # Matches messages with a UID in _sequence-set_.
2032
+ #
2033
+ # +ANSWERED+::
2034
+ # +UNANSWERED+::
2035
+ # Matches messages with or without the <tt>\\Answered</tt> flag.
2036
+ # +DELETED+::
2037
+ # +UNDELETED+::
2038
+ # Matches messages with or without the <tt>\\Deleted</tt> flag.
2039
+ # +DRAFT+::
2040
+ # +UNDRAFT+::
2041
+ # Matches messages with or without the <tt>\\Draft</tt> flag.
2042
+ # +FLAGGED+::
2043
+ # +UNFLAGGED+::
2044
+ # Matches messages with or without the <tt>\\Flagged</tt> flag.
2045
+ # +SEEN+::
2046
+ # +UNSEEN+::
2047
+ # Matches messages with or without the <tt>\\Seen</tt> flag.
2048
+ #
2049
+ # +KEYWORD+ _keyword_::
2050
+ # +UNKEYWORD+ _keyword_::
2051
+ # Matches messages with or without the specified _keyword_.
2052
+ #
2053
+ # +BCC+ _substring_::
2054
+ # Matches when _substring_ is in the envelope's BCC field.
2055
+ # +CC+ _substring_::
2056
+ # Matches when _substring_ is in the envelope's CC field.
2057
+ # +FROM+ _substring_::
2058
+ # Matches when _substring_ is in the envelope's FROM field.
2059
+ # +SUBJECT+ _substring_::
2060
+ # Matches when _substring_ is in the envelope's SUBJECT field.
2061
+ # +TO+ _substring_::
2062
+ # Matches when _substring_ is in the envelope's TO field.
2063
+ #
2064
+ # +HEADER+ _field_ _substring_::
2065
+ # Matches when _substring_ is in the specified header _field_.
2066
+ #
2067
+ # +BODY+ _string_::
2068
+ # Matches when _string_ is in the body of the message.
2069
+ # Does not match on header fields.
2070
+ #
2071
+ # The server _may_ use flexible matching, rather than simple substring
2072
+ # matches. For example, this may use stemming or match only full words.
2073
+ #
2074
+ # +TEXT+ _string_::
2075
+ # Matches when _string_ is in the header or body of the message.
2076
+ #
2077
+ # The server _may_ use flexible matching, rather than simple substring
2078
+ # matches. For example, this may use stemming or match only full words.
2079
+ #
2080
+ # +BEFORE+ _date_::
2081
+ # +ON+ _date_::
2082
+ # +SINCE+ _date_::
2083
+ # Matches when the +INTERNALDATE+ is earlier than, on, or later than
2084
+ # _date_.
2085
+ #
2086
+ # +SENTBEFORE+ _date_::
2087
+ # +SENTON+ _date_::
2088
+ # +SENTSINCE+ _date_::
2089
+ # Matches when the +Date+ header is earlier than, on, or later than _date_.
2090
+ #
2091
+ # +SMALLER+ _bytes_::
2092
+ # +LARGER+ _bytes_::
2093
+ # Matches when +RFC822.SIZE+ is smaller/larger than _bytes_.
2094
+ #
2095
+ # ====== Removed from +IMAP4rev2+
2096
+ #
2097
+ # The <tt>\\Recent</tt> flag has been removed from +IMAP4rev2+. So these
2098
+ # search keys require the +IMAP4rev1+ capability.
1954
2099
  #
1955
- # <message set>:: a set of message sequence numbers. "<tt>,</tt>" indicates
1956
- # an interval, "+:+" indicates a range. For instance,
1957
- # "<tt>2,10:12,15</tt>" means "<tt>2,10,11,12,15</tt>".
2100
+ # +RECENT+::
2101
+ # +UNRECENT+::
2102
+ # Matches messages with or without the <tt>\\Recent</tt> flag.
1958
2103
  #
1959
- # BEFORE <date>:: messages with an internal date strictly before
1960
- # <b><date></b>. The date argument has a format similar
1961
- # to <tt>8-Aug-2002</tt>, and can be formatted using
1962
- # Net::IMAP.format_date.
2104
+ # +NEW+::
2105
+ # Equivalent to <tt>(RECENT UNSEEN)</tt>.
1963
2106
  #
1964
- # BODY <string>:: messages that contain <string> within their body.
2107
+ # ====== Extension search keys
1965
2108
  #
1966
- # CC <string>:: messages containing <string> in their CC field.
2109
+ # The search keys described below are defined by standard \IMAP extensions.
1967
2110
  #
1968
- # FROM <string>:: messages that contain <string> in their FROM field.
2111
+ # +OLDER+ _interval_::
2112
+ # +YOUNGER+ _interval_::
2113
+ # Matches when +INTERNALDATE+ is more/less than _interval_ seconds ago.
1969
2114
  #
1970
- # NEW:: messages with the \Recent, but not the \Seen, flag set.
2115
+ # <em>Requires the +WITHIN+ capability</em>.
2116
+ # {[RFC5032]}[https://www.rfc-editor.org/rfc/rfc5032.html]
1971
2117
  #
1972
- # NOT <search-key>:: negate the following search key.
2118
+ # +ANNOTATION+ _entry_ _attr_ _value_::
2119
+ # Matches messages that have annotations with entries matching _entry_,
2120
+ # attributes matching _attr_, and _value_ in the attribute's values.
1973
2121
  #
1974
- # OR <search-key> <search-key>:: "or" two search keys together.
2122
+ # <em>Requires the +ANNOTATE-EXPERIMENT-1+ capability</em>.
2123
+ # {[RFC5257]}[https://www.rfc-editor.org/rfc/rfc5257.html].
1975
2124
  #
1976
- # ON <date>:: messages with an internal date exactly equal to <date>,
1977
- # which has a format similar to 8-Aug-2002.
2125
+ # +FILTER+ _filter_::
2126
+ # References a _filter_ that is stored on the server and matches all
2127
+ # messages which would be matched by that filter's search criteria.
1978
2128
  #
1979
- # SINCE <date>:: messages with an internal date on or after <date>.
2129
+ # <em>Requires the +FILTERS+ capability</em>.
2130
+ # {[RFC5466]}[https://www.rfc-editor.org/rfc/rfc5466.html#section-3.1]
1980
2131
  #
1981
- # SUBJECT <string>:: messages with <string> in their subject.
2132
+ # +FUZZY+ _search-key_::
2133
+ # Uses fuzzy matching for the specified search key.
1982
2134
  #
1983
- # TO <string>:: messages with <string> in their TO field.
2135
+ # <em>Requires the <tt>SEARCH=FUZZY</tt> capability.</em>
2136
+ # {[RFC6203]}[https://www.rfc-editor.org/rfc/rfc6203.html#section-6].
1984
2137
  #
1985
- # ===== For example:
2138
+ # +MODSEQ+ _modseq_::
2139
+ # Matches when +MODSEQ+ is greater than or equal to _modseq_.
1986
2140
  #
1987
- # p imap.search(["SUBJECT", "hello", "NOT", "NEW"])
1988
- # #=> [1, 6, 7, 8]
2141
+ # <em>Requires the +CONDSTORE+ capability</em>.
2142
+ # {[RFC7162]}[https://www.rfc-editor.org/rfc/rfc7162.html#section-3.1.5].
2143
+ #
2144
+ # +MODSEQ+ _entry_ _entry-type_ _modseq_::
2145
+ # Matches when a specific metadata _entry_ has been updated since
2146
+ # _modseq_.
2147
+ #
2148
+ # For flags, the corresponding _entry_ name is
2149
+ # <tt>"/flags/#{flag_name}"</tt>, where _flag_name_ includes the
2150
+ # <tt>\\</tt> prefix. _entry-type_ can be one of <tt>"shared"</tt>,
2151
+ # <tt>"priv"</tt> (private), or <tt>"all"</tt>.
2152
+ #
2153
+ # <em>Requires the +CONDSTORE+ capability</em>.
2154
+ # {[RFC7162]}[https://www.rfc-editor.org/rfc/rfc7162.html#section-3.1.5].
2155
+ #
2156
+ # +EMAILID+ _objectid_::
2157
+ # +THREADID+ _objectid_::
2158
+ # Matches when +EMAILID+/+THREADID+ is equal to _objectid_
2159
+ # (substring matches are not supported).
2160
+ #
2161
+ # <em>Requires the +OBJECTID+ capability</em>.
2162
+ # {[RFC8474]}[https://www.rfc-editor.org/rfc/rfc8474.html#section-6]
2163
+ #
2164
+ # +SAVEDATESUPPORTED+::
2165
+ # Matches every message in the mailbox when the mailbox supports the save
2166
+ # date attribute. Otherwise, it matches no messages.
2167
+ #
2168
+ # <em>Requires the +SAVEDATE+ capability</em>.
2169
+ # {[RFC8514]}[https://www.rfc-editor.org/rfc/rfc8514.html#section-4.3]
2170
+ #
2171
+ # +SAVEDBEFORE+ _date_::
2172
+ # +SAVEDON+ _date_::
2173
+ # +SAVEDSINCE+ _date_::
2174
+ # Matches when the save date is earlier than, on, or later than _date_.
2175
+ #
2176
+ # <em>Requires the +SAVEDATE+ capability.</em>
2177
+ # {[RFC8514]}[https://www.rfc-editor.org/rfc/rfc8514.html#section-4.3]
1989
2178
  #
1990
2179
  # ===== Capabilities
1991
2180
  #
1992
- # If [CONDSTORE[https://www.rfc-editor.org/rfc/rfc7162.html]] is supported
2181
+ # If CONDSTORE[https://www.rfc-editor.org/rfc/rfc7162.html] is supported
1993
2182
  # and enabled for the selected mailbox, a non-empty SearchResult will
1994
2183
  # include a +MODSEQ+ value.
1995
2184
  # imap.select("mbox", condstore: true)
1996
- # result = imap.search(["SUBJECT", "hi there", "not", "new")
2185
+ # result = imap.search(["SUBJECT", "hi there", "not", "new"])
1997
2186
  # #=> Net::IMAP::SearchResult[1, 6, 7, 8, modseq: 5594]
1998
2187
  # result.modseq # => 5594
1999
- def search(keys, charset = nil)
2000
- return search_internal("SEARCH", keys, charset)
2188
+ def search(...)
2189
+ search_internal("SEARCH", ...)
2001
2190
  end
2002
2191
 
2192
+ # :call-seq:
2193
+ # uid_search(criteria, charset = nil) -> result
2194
+ #
2003
2195
  # Sends a {UID SEARCH command [IMAP4rev1 §6.4.8]}[https://www.rfc-editor.org/rfc/rfc3501#section-6.4.8]
2004
2196
  # to search the mailbox for messages that match the given searching
2005
2197
  # criteria, and returns unique identifiers (<tt>UID</tt>s).
@@ -2008,9 +2200,9 @@ module Net
2008
2200
  # backward compatibility) but adds SearchResult#modseq when the +CONDSTORE+
2009
2201
  # capability has been enabled.
2010
2202
  #
2011
- # See #search for documentation of search criteria.
2012
- def uid_search(keys, charset = nil)
2013
- return search_internal("UID SEARCH", keys, charset)
2203
+ # See #search for documentation of parameters.
2204
+ def uid_search(...)
2205
+ search_internal("UID SEARCH", ...)
2014
2206
  end
2015
2207
 
2016
2208
  # :call-seq:
@@ -2939,18 +3131,11 @@ module Net
2939
3131
  end
2940
3132
  end
2941
3133
 
2942
- def search_internal(cmd, keys, charset)
2943
- if keys.instance_of?(String)
2944
- keys = [RawData.new(keys)]
2945
- else
2946
- normalize_searching_criteria(keys)
2947
- end
3134
+ def search_internal(cmd, keys, charset = nil)
3135
+ keys = normalize_searching_criteria(keys)
3136
+ args = charset ? ["CHARSET", charset, *keys] : keys
2948
3137
  synchronize do
2949
- if charset
2950
- send_command(cmd, "CHARSET", charset, *keys)
2951
- else
2952
- send_command(cmd, *keys)
2953
- end
3138
+ send_command(cmd, *args)
2954
3139
  clear_responses("SEARCH").last || []
2955
3140
  end
2956
3141
  end
@@ -2997,11 +3182,7 @@ module Net
2997
3182
  end
2998
3183
 
2999
3184
  def sort_internal(cmd, sort_keys, search_keys, charset)
3000
- if search_keys.instance_of?(String)
3001
- search_keys = [RawData.new(search_keys)]
3002
- else
3003
- normalize_searching_criteria(search_keys)
3004
- end
3185
+ search_keys = normalize_searching_criteria(search_keys)
3005
3186
  synchronize do
3006
3187
  send_command(cmd, sort_keys, charset, *search_keys)
3007
3188
  clear_responses("SORT").last || []
@@ -3009,25 +3190,39 @@ module Net
3009
3190
  end
3010
3191
 
3011
3192
  def thread_internal(cmd, algorithm, search_keys, charset)
3012
- if search_keys.instance_of?(String)
3013
- search_keys = [RawData.new(search_keys)]
3014
- else
3015
- normalize_searching_criteria(search_keys)
3016
- end
3193
+ search_keys = normalize_searching_criteria(search_keys)
3017
3194
  synchronize do
3018
3195
  send_command(cmd, algorithm, charset, *search_keys)
3019
3196
  clear_responses("THREAD").last || []
3020
3197
  end
3021
3198
  end
3022
3199
 
3023
- def normalize_searching_criteria(keys)
3024
- keys.collect! do |i|
3025
- case i
3026
- when -1, Range, Array
3027
- SequenceSet.new(i)
3200
+ def normalize_searching_criteria(criteria)
3201
+ return RawData.new(criteria) if criteria.is_a?(String)
3202
+ criteria.map {|i|
3203
+ if coerce_search_arg_to_seqset?(i)
3204
+ SequenceSet[i]
3028
3205
  else
3029
3206
  i
3030
3207
  end
3208
+ }
3209
+ end
3210
+
3211
+ def coerce_search_arg_to_seqset?(obj)
3212
+ case obj
3213
+ when Set, -1, :* then true
3214
+ when Range then true
3215
+ when Array then obj.all? { coerce_search_array_arg_to_seqset? _1 }
3216
+ else obj.respond_to?(:to_sequence_set)
3217
+ end
3218
+ end
3219
+
3220
+ def coerce_search_array_arg_to_seqset?(obj)
3221
+ case obj
3222
+ when Integer then obj.positive? || obj == -1
3223
+ when String then ResponseParser::Patterns::SEQUENCE_SET_STR.match?(obj.b)
3224
+ else
3225
+ coerce_search_arg_to_seqset?(obj)
3031
3226
  end
3032
3227
  end
3033
3228
 
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "set" unless defined?(::Set)
4
+
3
5
  # Generator for stringprep regexps.
4
6
  #
5
7
  # Combines Unicode character classes with generated tables. Generated regexps
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: net-imap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shugo Maeda
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2024-10-16 00:00:00.000000000 Z
12
+ date: 2024-11-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: net-protocol
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  - !ruby/object:Gem::Version
126
126
  version: '0'
127
127
  requirements: []
128
- rubygems_version: 3.5.16
128
+ rubygems_version: 3.5.22
129
129
  signing_key:
130
130
  specification_version: 4
131
131
  summary: Ruby client api for Internet Message Access Protocol