net-imap 0.5.6 → 0.6.0
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 +7 -4
- data/lib/net/imap/command_data.rb +0 -68
- data/lib/net/imap/config/attr_inheritance.rb +14 -1
- data/lib/net/imap/config/attr_type_coercion.rb +35 -22
- data/lib/net/imap/config/attr_version_defaults.rb +93 -0
- data/lib/net/imap/config.rb +265 -95
- data/lib/net/imap/connection_state.rb +48 -0
- data/lib/net/imap/data_encoding.rb +77 -28
- data/lib/net/imap/errors.rb +33 -0
- data/lib/net/imap/esearch_result.rb +48 -3
- data/lib/net/imap/flags.rb +1 -1
- data/lib/net/imap/response_data.rb +2 -4
- data/lib/net/imap/response_parser.rb +8 -13
- data/lib/net/imap/response_reader.rb +73 -0
- data/lib/net/imap/search_result.rb +8 -3
- data/lib/net/imap/sequence_set.rb +1113 -431
- data/lib/net/imap/uidplus_data.rb +2 -63
- data/lib/net/imap/vanished_data.rb +10 -1
- data/lib/net/imap.rb +291 -81
- data/net-imap.gemspec +1 -1
- data/rakelib/string_prep_tables_generator.rb +4 -2
- metadata +7 -5
- data/lib/net/imap/data_lite.rb +0 -226
|
@@ -3,69 +3,8 @@
|
|
|
3
3
|
module Net
|
|
4
4
|
class IMAP < Protocol
|
|
5
5
|
|
|
6
|
-
# *NOTE:* <em>UIDPlusData is deprecated and will be removed in the +0.6.0+
|
|
7
|
-
# release.</em> To use AppendUIDData and CopyUIDData before +0.6.0+, set
|
|
8
|
-
# Config#parser_use_deprecated_uidplus_data to +false+.
|
|
9
|
-
#
|
|
10
|
-
# UIDPlusData represents the ResponseCode#data that accompanies the
|
|
11
|
-
# +APPENDUID+ and +COPYUID+ {response codes}[rdoc-ref:ResponseCode].
|
|
12
|
-
#
|
|
13
|
-
# A server that supports +UIDPLUS+ should send UIDPlusData in response to
|
|
14
|
-
# the append[rdoc-ref:Net::IMAP#append], copy[rdoc-ref:Net::IMAP#copy],
|
|
15
|
-
# move[rdoc-ref:Net::IMAP#move], {uid copy}[rdoc-ref:Net::IMAP#uid_copy],
|
|
16
|
-
# and {uid move}[rdoc-ref:Net::IMAP#uid_move] commands---unless the
|
|
17
|
-
# destination mailbox reports +UIDNOTSTICKY+.
|
|
18
|
-
#
|
|
19
|
-
# Note that append[rdoc-ref:Net::IMAP#append], copy[rdoc-ref:Net::IMAP#copy]
|
|
20
|
-
# and {uid_copy}[rdoc-ref:Net::IMAP#uid_copy] return UIDPlusData in their
|
|
21
|
-
# TaggedResponse. But move[rdoc-ref:Net::IMAP#copy] and
|
|
22
|
-
# {uid_move}[rdoc-ref:Net::IMAP#uid_move] _should_ send UIDPlusData in an
|
|
23
|
-
# UntaggedResponse response before sending their TaggedResponse. However
|
|
24
|
-
# some servers do send UIDPlusData in the TaggedResponse for +MOVE+
|
|
25
|
-
# commands---this complies with the older +UIDPLUS+ specification but is
|
|
26
|
-
# discouraged by the +MOVE+ extension and disallowed by +IMAP4rev2+.
|
|
27
|
-
#
|
|
28
|
-
# == Required capability
|
|
29
|
-
# Requires either +UIDPLUS+ [RFC4315[https://www.rfc-editor.org/rfc/rfc4315]]
|
|
30
|
-
# or +IMAP4rev2+ capability.
|
|
31
|
-
#
|
|
32
|
-
class UIDPlusData < Struct.new(:uidvalidity, :source_uids, :assigned_uids)
|
|
33
|
-
##
|
|
34
|
-
# method: uidvalidity
|
|
35
|
-
# :call-seq: uidvalidity -> nonzero uint32
|
|
36
|
-
#
|
|
37
|
-
# The UIDVALIDITY of the destination mailbox.
|
|
38
|
-
|
|
39
|
-
##
|
|
40
|
-
# method: source_uids
|
|
41
|
-
# :call-seq: source_uids -> nil or an array of nonzero uint32
|
|
42
|
-
#
|
|
43
|
-
# The UIDs of the copied or moved messages.
|
|
44
|
-
#
|
|
45
|
-
# Note:: Returns +nil+ for Net::IMAP#append.
|
|
46
|
-
|
|
47
|
-
##
|
|
48
|
-
# method: assigned_uids
|
|
49
|
-
# :call-seq: assigned_uids -> an array of nonzero uint32
|
|
50
|
-
#
|
|
51
|
-
# The newly assigned UIDs of the copied, moved, or appended messages.
|
|
52
|
-
#
|
|
53
|
-
# Note:: This always returns an array, even when it contains only one UID.
|
|
54
|
-
|
|
55
|
-
##
|
|
56
|
-
# :call-seq: uid_mapping -> nil or a hash
|
|
57
|
-
#
|
|
58
|
-
# Returns a hash mapping each source UID to the newly assigned destination
|
|
59
|
-
# UID.
|
|
60
|
-
#
|
|
61
|
-
# Note:: Returns +nil+ for Net::IMAP#append.
|
|
62
|
-
def uid_mapping
|
|
63
|
-
source_uids&.zip(assigned_uids)&.to_h
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
|
|
67
6
|
# >>>
|
|
68
|
-
# *NOTE:* <em>AppendUIDData
|
|
7
|
+
# *NOTE:* <em>AppendUIDData replaced UIDPlusData for +APPENDUID+ in the
|
|
69
8
|
# +0.6.0+ release.</em> To use AppendUIDData before +0.6.0+, set
|
|
70
9
|
# Config#parser_use_deprecated_uidplus_data to +false+.
|
|
71
10
|
#
|
|
@@ -109,7 +48,7 @@ module Net
|
|
|
109
48
|
end
|
|
110
49
|
|
|
111
50
|
# >>>
|
|
112
|
-
# *NOTE:* <em>CopyUIDData
|
|
51
|
+
# *NOTE:* <em>CopyUIDData replaced UIDPlusData for +COPYUID+ in the
|
|
113
52
|
# +0.6.0+ release.</em> To use CopyUIDData before +0.6.0+, set
|
|
114
53
|
# Config#parser_use_deprecated_uidplus_data to +false+.
|
|
115
54
|
#
|
|
@@ -19,7 +19,7 @@ module Net
|
|
|
19
19
|
# * +uids+ will be converted by SequenceSet.[].
|
|
20
20
|
# * +earlier+ will be converted to +true+ or +false+
|
|
21
21
|
def initialize(uids:, earlier:)
|
|
22
|
-
uids = SequenceSet[uids]
|
|
22
|
+
uids = SequenceSet[uids] unless uids.equal? SequenceSet.empty
|
|
23
23
|
earlier = !!earlier
|
|
24
24
|
super
|
|
25
25
|
end
|
|
@@ -51,6 +51,15 @@ module Net
|
|
|
51
51
|
# See SequenceSet#numbers.
|
|
52
52
|
def to_a; uids.numbers end
|
|
53
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
|
|
54
63
|
end
|
|
55
64
|
end
|
|
56
65
|
end
|