class Net::IMAP::CopyUIDData
or IMAP4rev2
capability.
Requires either UIDPLUS
[RFC4315]
== Required capability
discouraged by the MOVE
extension and disallowed by IMAP4rev2
.
commands—this complies with the older UIDPLUS
specification but is
some servers do send CopyUIDData in the TaggedResponse for MOVE
UntaggedResponse response before sending their TaggedResponse. However
should send CopyUIDData in an
TaggedResponse. But move and
return CopyUIDData in their
Note that copy and
commands—unless the destination mailbox reports UIDNOTSTICKY
.<br>move, and uid_move, uid_copy,
in response to
A server that supports UIDPLUS
(or IMAP4rev2
) should send CopyUIDDataCOPYUID
response code.
CopyUIDData represents the ResponseCode#data that accompanies the
Config#parser_use_deprecated_uidplus_data to false
.0.6.0
release.</em> To use CopyUIDData before 0.6.0
, set
NOTE: <em>CopyUIDData will replace UIDPlusData for COPYUID
in the
>>>
def assigned_uid_for(source_uid)
This is the reverse of #source_uid_for.
copied from +source_uid+ in the source mailbox.
Returns the UID in the destination mailbox for the message that was
self[source_uid] -> uid
assigned_uid_for(source_uid) -> uid
:call-seq:
def assigned_uid_for(source_uid) idx = source_uids.find_ordered_index(source_uid) and assigned_uids.ordered_at(idx) end
def each_uid_pair
+to_h+ or +to_a+ on the returned enumerator.
Please note the warning on uid_mapping before calling methods like
Returns an enumerator when no block is given.
destination mailbox.
message's UID in the source mailbox and the second is the UID in the
Yields a pair of UIDs for each copied message. The first is the
def each_uid_pair return enum_for(__method__) unless block_given? source_uids.each_ordered_number.lazy .zip(assigned_uids.each_ordered_number.lazy) do |source_uid, assigned_uid| yield source_uid, assigned_uid end end
def initialize(uidvalidity:, source_uids:, assigned_uids:)
def initialize(uidvalidity:, source_uids:, assigned_uids:) uidvalidity = Integer(uidvalidity) source_uids = SequenceSet[source_uids] assigned_uids = SequenceSet[assigned_uids] NumValidator.ensure_nz_number(uidvalidity) if source_uids.include_star? || assigned_uids.include_star? raise DataFormatError, "uid-set cannot contain '*'" elsif source_uids.count_with_duplicates != assigned_uids.count_with_duplicates raise DataFormatError, "mismatched uid-set sizes for %s and %s" % [ source_uids, assigned_uids ] end super end
def size
Returns the number of messages that have been copied or moved.
def size assigned_uids.count_with_duplicates end
def source_uid_for(assigned_uid)
This is the reverse of #assigned_uid_for.
+assigned_uid+ in the source mailbox.
Returns the UID in the source mailbox for the message that was copied to
source_uid_for(assigned_uid) -> uid
:call-seq:
def source_uid_for(assigned_uid) idx = assigned_uids.find_ordered_index(assigned_uid) and source_uids.ordered_at(idx) end
def uid_mapping
untrusted server, check #size before calling this method.
memory than the data used to create it. When handling responses from an
*Warning:* The hash that is created may consume _much_ more
UID.
Returns a hash mapping each source UID to the newly assigned destination
:call-seq: uid_mapping -> hash
def uid_mapping each_uid_pair.to_h end