net-imap 0.4.24 → 0.5.14
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.
- checksums.yaml +4 -4
- data/Gemfile +10 -1
- data/README.md +10 -4
- data/docs/styles.css +75 -14
- data/lib/net/imap/authenticators.rb +2 -2
- data/lib/net/imap/command_data.rb +73 -78
- data/lib/net/imap/config/attr_type_coercion.rb +22 -10
- data/lib/net/imap/config/attr_version_defaults.rb +93 -0
- data/lib/net/imap/config.rb +70 -94
- data/lib/net/imap/connection_state.rb +48 -0
- data/lib/net/imap/data_encoding.rb +3 -3
- data/lib/net/imap/data_lite.rb +226 -0
- data/lib/net/imap/deprecated_client_options.rb +6 -3
- data/lib/net/imap/errors.rb +6 -0
- data/lib/net/imap/esearch_result.rb +219 -0
- data/lib/net/imap/fetch_data.rb +126 -47
- data/lib/net/imap/flags.rb +1 -1
- data/lib/net/imap/response_data.rb +120 -186
- data/lib/net/imap/response_parser/parser_utils.rb +5 -0
- data/lib/net/imap/response_parser.rb +155 -21
- data/lib/net/imap/response_reader.rb +9 -12
- data/lib/net/imap/sasl/anonymous_authenticator.rb +3 -3
- data/lib/net/imap/sasl/authentication_exchange.rb +52 -20
- data/lib/net/imap/sasl/authenticators.rb +8 -4
- data/lib/net/imap/sasl/client_adapter.rb +77 -26
- data/lib/net/imap/sasl/cram_md5_authenticator.rb +4 -4
- data/lib/net/imap/sasl/digest_md5_authenticator.rb +218 -56
- data/lib/net/imap/sasl/external_authenticator.rb +2 -2
- data/lib/net/imap/sasl/gs2_header.rb +7 -7
- data/lib/net/imap/sasl/login_authenticator.rb +4 -3
- data/lib/net/imap/sasl/oauthbearer_authenticator.rb +6 -6
- data/lib/net/imap/sasl/plain_authenticator.rb +7 -7
- data/lib/net/imap/sasl/protocol_adapters.rb +60 -4
- data/lib/net/imap/sasl/scram_authenticator.rb +10 -10
- data/lib/net/imap/sasl.rb +7 -4
- data/lib/net/imap/sasl_adapter.rb +0 -1
- data/lib/net/imap/search_result.rb +4 -5
- data/lib/net/imap/sequence_set.rb +529 -154
- data/lib/net/imap/stringprep/nameprep.rb +1 -1
- data/lib/net/imap/stringprep/trace.rb +4 -4
- data/lib/net/imap/uidplus_data.rb +2 -84
- data/lib/net/imap/vanished_data.rb +65 -0
- data/lib/net/imap.rb +996 -305
- data/net-imap.gemspec +1 -1
- data/rakelib/rfcs.rake +2 -0
- data/rakelib/string_prep_tables_generator.rb +6 -2
- metadata +7 -2
|
@@ -4,7 +4,7 @@ module Net
|
|
|
4
4
|
class IMAP
|
|
5
5
|
module StringPrep
|
|
6
6
|
|
|
7
|
-
# Defined in RFC3491[https://
|
|
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://
|
|
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://
|
|
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://
|
|
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://
|
|
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].
|
|
@@ -64,44 +64,6 @@ module Net
|
|
|
64
64
|
end
|
|
65
65
|
end
|
|
66
66
|
|
|
67
|
-
# This replaces the `Data.define` polyfill that's used by net-imap 0.5.
|
|
68
|
-
class Data_define__uidvalidity___assigned_uids_ # :no-doc:
|
|
69
|
-
attr_reader :uidvalidity, :assigned_uids
|
|
70
|
-
|
|
71
|
-
def self.[](...) new(...) end
|
|
72
|
-
def self.new(uidvalidity = (args = false; nil),
|
|
73
|
-
assigned_uids = nil,
|
|
74
|
-
**kwargs)
|
|
75
|
-
if kwargs.empty?
|
|
76
|
-
super(uidvalidity: uidvalidity, assigned_uids: assigned_uids)
|
|
77
|
-
elsif !args
|
|
78
|
-
super
|
|
79
|
-
else
|
|
80
|
-
raise ArgumentError, "sent both positional and keyword args"
|
|
81
|
-
end
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
def ==(other)
|
|
85
|
-
self.class == other.class &&
|
|
86
|
-
self.uidvalidity == other.uidvalidity &&
|
|
87
|
-
self.assigned_uids == other.assigned_uids
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
def eql?(other)
|
|
91
|
-
self.class.eql?(other.class) &&
|
|
92
|
-
self.uidvalidity.eql?(other.uidvalidity) &&
|
|
93
|
-
self.assigned_uids.eql?(other.assigned_uids)
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
def hash; [self.class, uidvalidity, assigned_uids].hash end
|
|
97
|
-
|
|
98
|
-
def initialize(uidvalidity:, assigned_uids:)
|
|
99
|
-
@uidvalidity = uidvalidity
|
|
100
|
-
@assigned_uids = assigned_uids
|
|
101
|
-
freeze
|
|
102
|
-
end
|
|
103
|
-
end
|
|
104
|
-
|
|
105
67
|
# >>>
|
|
106
68
|
# *NOTE:* <em>AppendUIDData will replace UIDPlusData for +APPENDUID+ in the
|
|
107
69
|
# +0.6.0+ release.</em> To use AppendUIDData before +0.6.0+, set
|
|
@@ -118,7 +80,7 @@ module Net
|
|
|
118
80
|
# == Required capability
|
|
119
81
|
# Requires either +UIDPLUS+ [RFC4315[https://www.rfc-editor.org/rfc/rfc4315]]
|
|
120
82
|
# or +IMAP4rev2+ capability.
|
|
121
|
-
class AppendUIDData <
|
|
83
|
+
class AppendUIDData < Data.define(:uidvalidity, :assigned_uids)
|
|
122
84
|
def initialize(uidvalidity:, assigned_uids:)
|
|
123
85
|
uidvalidity = Integer(uidvalidity)
|
|
124
86
|
assigned_uids = SequenceSet[assigned_uids]
|
|
@@ -146,50 +108,6 @@ module Net
|
|
|
146
108
|
end
|
|
147
109
|
end
|
|
148
110
|
|
|
149
|
-
# This replaces the `Data.define` polyfill that's used by net-imap 0.5.
|
|
150
|
-
class Data_define__uidvalidity___source_uids___assigned_uids_ # :no-doc:
|
|
151
|
-
attr_reader :uidvalidity, :source_uids, :assigned_uids
|
|
152
|
-
|
|
153
|
-
def self.[](...) new(...) end
|
|
154
|
-
def self.new(uidvalidity = (args = false; nil),
|
|
155
|
-
source_uids = nil,
|
|
156
|
-
assigned_uids = nil,
|
|
157
|
-
**kwargs)
|
|
158
|
-
if kwargs.empty?
|
|
159
|
-
super(uidvalidity: uidvalidity,
|
|
160
|
-
source_uids: source_uids,
|
|
161
|
-
assigned_uids: assigned_uids)
|
|
162
|
-
elsif !args
|
|
163
|
-
super(**kwargs)
|
|
164
|
-
else
|
|
165
|
-
raise ArgumentError, "sent both positional and keyword args"
|
|
166
|
-
end
|
|
167
|
-
end
|
|
168
|
-
|
|
169
|
-
def initialize(uidvalidity:, source_uids:, assigned_uids:)
|
|
170
|
-
@uidvalidity = uidvalidity
|
|
171
|
-
@source_uids = source_uids
|
|
172
|
-
@assigned_uids = assigned_uids
|
|
173
|
-
freeze
|
|
174
|
-
end
|
|
175
|
-
|
|
176
|
-
def ==(other)
|
|
177
|
-
self.class == other.class &&
|
|
178
|
-
self.uidvalidity == other.uidvalidity &&
|
|
179
|
-
self.source_uids == other.source_uids
|
|
180
|
-
self.assigned_uids == other.assigned_uids
|
|
181
|
-
end
|
|
182
|
-
|
|
183
|
-
def eql?(other)
|
|
184
|
-
self.class.eql?(other.class) &&
|
|
185
|
-
self.uidvalidity.eql?(other.uidvalidity) &&
|
|
186
|
-
self.source_uids.eql?(other.source_uids)
|
|
187
|
-
self.assigned_uids.eql?(other.assigned_uids)
|
|
188
|
-
end
|
|
189
|
-
|
|
190
|
-
def hash; [self.class, uidvalidity, source_uids, assigned_uids].hash end
|
|
191
|
-
end
|
|
192
|
-
|
|
193
111
|
# >>>
|
|
194
112
|
# *NOTE:* <em>CopyUIDData will replace UIDPlusData for +COPYUID+ in the
|
|
195
113
|
# +0.6.0+ release.</em> To use CopyUIDData before +0.6.0+, set
|
|
@@ -216,7 +134,7 @@ module Net
|
|
|
216
134
|
# == Required capability
|
|
217
135
|
# Requires either +UIDPLUS+ [RFC4315[https://www.rfc-editor.org/rfc/rfc4315]]
|
|
218
136
|
# or +IMAP4rev2+ capability.
|
|
219
|
-
class CopyUIDData <
|
|
137
|
+
class CopyUIDData < Data.define(:uidvalidity, :source_uids, :assigned_uids)
|
|
220
138
|
def initialize(uidvalidity:, source_uids:, assigned_uids:)
|
|
221
139
|
uidvalidity = Integer(uidvalidity)
|
|
222
140
|
source_uids = SequenceSet[source_uids]
|
|
@@ -0,0 +1,65 @@
|
|
|
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] unless uids.equal? SequenceSet.empty
|
|
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
|
+
# Yields each UID in #uids and returns +self+. Returns an Enumerator when
|
|
55
|
+
# no block is given.
|
|
56
|
+
#
|
|
57
|
+
# See SequenceSet#each_number.
|
|
58
|
+
def each(&)
|
|
59
|
+
return to_enum unless block_given?
|
|
60
|
+
uids.each_number(&)
|
|
61
|
+
self
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|