net-imap 0.5.4 → 0.5.5
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 +4 -4
- data/README.md +3 -1
- data/docs/styles.css +11 -1
- data/lib/net/imap/config.rb +5 -3
- data/lib/net/imap/data_lite.rb +11 -10
- data/lib/net/imap/fetch_data.rb +126 -47
- data/lib/net/imap/response_data.rb +118 -100
- data/lib/net/imap/response_parser.rb +13 -2
- data/lib/net/imap/sasl/anonymous_authenticator.rb +3 -3
- data/lib/net/imap/sasl/cram_md5_authenticator.rb +3 -3
- data/lib/net/imap/sasl/digest_md5_authenticator.rb +8 -8
- 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 +2 -2
- 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/scram_authenticator.rb +8 -8
- data/lib/net/imap/sasl.rb +1 -1
- data/lib/net/imap/search_result.rb +2 -2
- data/lib/net/imap/stringprep/nameprep.rb +1 -1
- data/lib/net/imap/stringprep/trace.rb +4 -4
- data/lib/net/imap.rb +162 -100
- data/rakelib/rfcs.rake +1 -0
- metadata +3 -6
@@ -4,6 +4,7 @@ module Net
|
|
4
4
|
class IMAP < Protocol
|
5
5
|
autoload :ESearchResult, "#{__dir__}/esearch_result"
|
6
6
|
autoload :FetchData, "#{__dir__}/fetch_data"
|
7
|
+
autoload :UIDFetchData, "#{__dir__}/fetch_data"
|
7
8
|
autoload :SearchResult, "#{__dir__}/search_result"
|
8
9
|
autoload :SequenceSet, "#{__dir__}/sequence_set"
|
9
10
|
autoload :VanishedData, "#{__dir__}/vanished_data"
|
@@ -159,13 +160,20 @@ module Net
|
|
159
160
|
# The raw response data.
|
160
161
|
end
|
161
162
|
|
162
|
-
#
|
163
|
+
# ResponseText represents texts of responses.
|
163
164
|
#
|
164
165
|
# The text may be prefixed by a ResponseCode.
|
165
166
|
#
|
166
|
-
# ResponseText is returned from TaggedResponse#data
|
167
|
-
# UntaggedResponse#data
|
168
|
-
# "
|
167
|
+
# ResponseText is returned from TaggedResponse#data or
|
168
|
+
# UntaggedResponse#data for
|
169
|
+
# {"status responses"}[https://www.rfc-editor.org/rfc/rfc3501#section-7.1]:
|
170
|
+
# * every TaggedResponse, name[rdoc-ref:TaggedResponse#name] is always
|
171
|
+
# "+OK+", "+NO+", or "+BAD+".
|
172
|
+
# * any UntaggedResponse when name[rdoc-ref:UntaggedResponse#name] is
|
173
|
+
# "+OK+", "+NO+", "+BAD+", "+PREAUTH+", or "+BYE+".
|
174
|
+
#
|
175
|
+
# Note that these "status responses" are confusingly _not_ the same as the
|
176
|
+
# +STATUS+ UntaggedResponse (see IMAP#status and StatusData).
|
169
177
|
class ResponseText < Struct.new(:code, :text)
|
170
178
|
# Used to avoid an allocation when ResponseText is empty
|
171
179
|
EMPTY = new(nil, "").freeze
|
@@ -183,32 +191,35 @@ module Net
|
|
183
191
|
# Returns the response text, not including any response code
|
184
192
|
end
|
185
193
|
|
186
|
-
#
|
187
|
-
#
|
188
|
-
#
|
189
|
-
#
|
194
|
+
# ResponseCode represents an \IMAP response code, which can be retrieved
|
195
|
+
# from ResponseText#code for
|
196
|
+
# {"status responses"}[https://www.rfc-editor.org/rfc/rfc3501#section-7.1]:
|
197
|
+
# * every TaggedResponse, name[rdoc-ref:TaggedResponse#name] is always
|
198
|
+
# "+OK+", "+NO+", or "+BAD+".
|
199
|
+
# * any UntaggedResponse when name[rdoc-ref:UntaggedResponse#name] is
|
200
|
+
# "+OK+", "+NO+", "+BAD+", "+PREAUTH+", or "+BYE+".
|
201
|
+
#
|
202
|
+
# Note that these "status responses" are confusingly _not_ the same as the
|
203
|
+
# +STATUS+ UntaggedResponse (see IMAP#status and StatusData).
|
190
204
|
#
|
191
205
|
# Some response codes come with additional data which will be parsed by
|
192
206
|
# Net::IMAP. Others return +nil+ for #data, but are used as a
|
193
207
|
# machine-readable annotation for the human-readable ResponseText#text in
|
194
|
-
# the same response.
|
195
|
-
# code text, #data returns the unparsed string.
|
208
|
+
# the same response.
|
196
209
|
#
|
197
210
|
# Untagged response code #data is pushed directly onto Net::IMAP#responses,
|
198
211
|
# keyed by #name, unless it is removed by the command that generated it.
|
199
212
|
# Use Net::IMAP#add_response_handler to view tagged response codes for
|
200
213
|
# command methods that do not return their TaggedResponse.
|
201
214
|
#
|
215
|
+
# == Standard response codes
|
216
|
+
#
|
202
217
|
# \IMAP extensions may define new codes and the data that comes with them.
|
203
218
|
# The IANA {IMAP Response
|
204
219
|
# Codes}[https://www.iana.org/assignments/imap-response-codes/imap-response-codes.xhtml]
|
205
220
|
# registry has links to specifications for all standard response codes.
|
206
|
-
# Response codes are backwards compatible: Servers are allowed to send new
|
207
|
-
# response codes even if the client has not enabled the extension that
|
208
|
-
# defines them. When unknown response code data is encountered, #data
|
209
|
-
# will return an unparsed string.
|
210
221
|
#
|
211
|
-
#
|
222
|
+
# === +IMAP4rev1+ response codes
|
212
223
|
# See [IMAP4rev1[https://www.rfc-editor.org/rfc/rfc3501]] {§7.1, "Server
|
213
224
|
# Responses - Status
|
214
225
|
# Responses"}[https://www.rfc-editor.org/rfc/rfc3501#section-7.1] for full
|
@@ -239,24 +250,24 @@ module Net
|
|
239
250
|
# the <tt>\Seen</tt> flag set.
|
240
251
|
# <em>DEPRECATED by IMAP4rev2.</em>
|
241
252
|
#
|
242
|
-
#
|
253
|
+
# === +BINARY+ extension
|
243
254
|
# See {[RFC3516]}[https://www.rfc-editor.org/rfc/rfc3516].
|
244
255
|
# * +UNKNOWN-CTE+, with a tagged +NO+ response, when the server does not
|
245
256
|
# known how to decode a CTE (content-transfer-encoding). #data is +nil+.
|
246
257
|
# See IMAP#fetch.
|
247
258
|
#
|
248
|
-
#
|
259
|
+
# === +UIDPLUS+ extension
|
249
260
|
# See {[RFC4315 §3]}[https://www.rfc-editor.org/rfc/rfc4315#section-3].
|
250
261
|
# * +APPENDUID+, #data is UIDPlusData. See IMAP#append.
|
251
262
|
# * +COPYUID+, #data is UIDPlusData. See IMAP#copy.
|
252
263
|
# * +UIDNOTSTICKY+, #data is +nil+. See IMAP#select.
|
253
264
|
#
|
254
|
-
#
|
265
|
+
# === +SEARCHRES+ extension
|
255
266
|
# See {[RFC5182]}[https://www.rfc-editor.org/rfc/rfc5182].
|
256
267
|
# * +NOTSAVED+, with a tagged +NO+ response, when the search result variable
|
257
268
|
# is not saved. #data is +nil+.
|
258
269
|
#
|
259
|
-
#
|
270
|
+
# === +RFC5530+ response codes
|
260
271
|
# See {[RFC5530]}[https://www.rfc-editor.org/rfc/rfc5530], "IMAP Response
|
261
272
|
# Codes" for the definition of the following response codes, which are all
|
262
273
|
# machine-readable annotations for the human-readable ResponseText#text, and
|
@@ -279,22 +290,22 @@ module Net
|
|
279
290
|
# * +ALREADYEXISTS+
|
280
291
|
# * +NONEXISTENT+
|
281
292
|
#
|
282
|
-
#
|
293
|
+
# === +QRESYNC+ extension
|
283
294
|
# See {[RFC7162]}[https://www.rfc-editor.org/rfc/rfc7162.html].
|
284
295
|
# * +CLOSED+, returned when the currently selected mailbox is closed
|
285
296
|
# implicitly by selecting or examining another mailbox. #data is +nil+.
|
286
297
|
#
|
287
|
-
#
|
298
|
+
# === +IMAP4rev2+ response codes
|
288
299
|
# See {[RFC9051]}[https://www.rfc-editor.org/rfc/rfc9051] {§7.1, "Server
|
289
300
|
# Responses - Status
|
290
301
|
# Responses"}[https://www.rfc-editor.org/rfc/rfc9051#section-7.1] for full
|
291
302
|
# descriptions of IMAP4rev2 response codes. IMAP4rev2 includes all of the
|
292
|
-
# response codes listed above (except "UNSEEN") and adds the following:
|
303
|
+
# response codes listed above (except "+UNSEEN+") and adds the following:
|
293
304
|
# * +HASCHILDREN+, with a tagged +NO+ response, when a mailbox delete failed
|
294
305
|
# because the server doesn't allow deletion of mailboxes with children.
|
295
306
|
# #data is +nil+.
|
296
307
|
#
|
297
|
-
#
|
308
|
+
# === +CONDSTORE+ extension
|
298
309
|
# See {[RFC7162]}[https://www.rfc-editor.org/rfc/rfc7162.html].
|
299
310
|
# * +NOMODSEQ+, when selecting a mailbox that does not support
|
300
311
|
# mod-sequences. #data is +nil+. See IMAP#select.
|
@@ -304,10 +315,17 @@ module Net
|
|
304
315
|
# since the +UNCHANGEDSINCE+ mod-sequence given to +STORE+ or <tt>UID
|
305
316
|
# STORE</tt>.
|
306
317
|
#
|
307
|
-
#
|
318
|
+
# === +OBJECTID+ extension
|
308
319
|
# See {[RFC8474]}[https://www.rfc-editor.org/rfc/rfc8474.html].
|
309
320
|
# * +MAILBOXID+, #data is a string
|
310
321
|
#
|
322
|
+
# == Extension compatibility
|
323
|
+
#
|
324
|
+
# Response codes are backwards compatible: Servers are allowed to send new
|
325
|
+
# response codes even if the client has not enabled the extension that
|
326
|
+
# defines them. When Net::IMAP does not know how to parse response
|
327
|
+
# code text, #data returns the unparsed string.
|
328
|
+
#
|
311
329
|
class ResponseCode < Struct.new(:name, :data)
|
312
330
|
##
|
313
331
|
# method: name
|
@@ -326,14 +344,9 @@ module Net
|
|
326
344
|
# code data can take.
|
327
345
|
end
|
328
346
|
|
329
|
-
#
|
330
|
-
#
|
331
|
-
#
|
332
|
-
# See [[UIDPLUS[https://www.rfc-editor.org/rfc/rfc4315.html]].
|
333
|
-
#
|
334
|
-
# ==== Capability requirement
|
347
|
+
# UIDPlusData represents the ResponseCode#data that accompanies the
|
348
|
+
# +APPENDUID+ and +COPYUID+ {response codes}[rdoc-ref:ResponseCode].
|
335
349
|
#
|
336
|
-
# The +UIDPLUS+ capability[rdoc-ref:Net::IMAP#capability] must be supported.
|
337
350
|
# A server that supports +UIDPLUS+ should send a UIDPlusData object inside
|
338
351
|
# every TaggedResponse returned by the append[rdoc-ref:Net::IMAP#append],
|
339
352
|
# copy[rdoc-ref:Net::IMAP#copy], move[rdoc-ref:Net::IMAP#move], {uid
|
@@ -341,9 +354,9 @@ module Net
|
|
341
354
|
# move}[rdoc-ref:Net::IMAP#uid_move] commands---unless the destination
|
342
355
|
# mailbox reports +UIDNOTSTICKY+.
|
343
356
|
#
|
344
|
-
|
345
|
-
#
|
346
|
-
|
357
|
+
# == Required capability
|
358
|
+
# Requires either +UIDPLUS+ [RFC4315[https://www.rfc-editor.org/rfc/rfc4315]]
|
359
|
+
# or +IMAP4rev2+ capability.
|
347
360
|
#
|
348
361
|
class UIDPlusData < Struct.new(:uidvalidity, :source_uids, :assigned_uids)
|
349
362
|
##
|
@@ -380,10 +393,8 @@ module Net
|
|
380
393
|
end
|
381
394
|
end
|
382
395
|
|
383
|
-
#
|
384
|
-
#
|
385
|
-
#
|
386
|
-
# Net::IMAP#list returns an array of MailboxList objects.
|
396
|
+
# MailboxList represents the data of an untagged +LIST+ response, for a
|
397
|
+
# _single_ mailbox path. IMAP#list returns an array of MailboxList objects.
|
387
398
|
#
|
388
399
|
class MailboxList < Struct.new(:attr, :delim, :name)
|
389
400
|
##
|
@@ -393,11 +404,11 @@ module Net
|
|
393
404
|
# Returns the name attributes. Each name attribute is a symbol capitalized
|
394
405
|
# by String#capitalize, such as :Noselect (not :NoSelect). For the
|
395
406
|
# semantics of each attribute, see:
|
396
|
-
# *
|
397
|
-
# *
|
398
|
-
# * Net::IMAP@SPECIAL-USE
|
407
|
+
# * Net::IMAP@Basic+Mailbox+Attributes
|
408
|
+
# * Net::IMAP@Mailbox+role+Attributes
|
399
409
|
# * The IANA {IMAP Mailbox Name Attributes
|
400
410
|
# registry}[https://www.iana.org/assignments/imap-mailbox-name-attributes/imap-mailbox-name-attributes.xhtml]
|
411
|
+
# has links to specifications for all standard mailbox attributes.
|
401
412
|
|
402
413
|
##
|
403
414
|
# method: delim
|
@@ -412,16 +423,16 @@ module Net
|
|
412
423
|
# Returns the mailbox name.
|
413
424
|
end
|
414
425
|
|
415
|
-
#
|
416
|
-
# This object can also be a response to GETQUOTAROOT. In the syntax
|
417
|
-
# specification below, the delimiter used with the "#" construct is a
|
418
|
-
# single space (SPACE).
|
426
|
+
# MailboxQuota represents the data of an untagged +QUOTA+ response.
|
419
427
|
#
|
420
|
-
#
|
428
|
+
# IMAP#getquota returns an array of MailboxQuota objects.
|
421
429
|
#
|
422
430
|
# Net::IMAP#getquotaroot returns an array containing both MailboxQuotaRoot
|
423
431
|
# and MailboxQuota objects.
|
424
432
|
#
|
433
|
+
# == Required capability
|
434
|
+
# Requires +QUOTA+ [RFC2087[https://www.rfc-editor.org/rfc/rfc2087]]
|
435
|
+
# capability.
|
425
436
|
class MailboxQuota < Struct.new(:mailbox, :usage, :quota)
|
426
437
|
##
|
427
438
|
# method: mailbox
|
@@ -443,12 +454,14 @@ module Net
|
|
443
454
|
#
|
444
455
|
end
|
445
456
|
|
446
|
-
#
|
447
|
-
# response. (GETQUOTAROOT can also return Net::IMAP::MailboxQuota.)
|
457
|
+
# MailboxQuotaRoot represents the data of an untagged +QUOTAROOT+ response.
|
448
458
|
#
|
449
|
-
#
|
450
|
-
#
|
459
|
+
# IMAP#getquotaroot returns an array containing both MailboxQuotaRoot and
|
460
|
+
# MailboxQuota objects.
|
451
461
|
#
|
462
|
+
# == Required capability
|
463
|
+
# Requires +QUOTA+ [RFC2087[https://www.rfc-editor.org/rfc/rfc2087]]
|
464
|
+
# capability.
|
452
465
|
class MailboxQuotaRoot < Struct.new(:mailbox, :quotaroots)
|
453
466
|
##
|
454
467
|
# method: mailbox
|
@@ -463,12 +476,13 @@ module Net
|
|
463
476
|
# Zero or more quotaroots that affect the quota on the specified mailbox.
|
464
477
|
end
|
465
478
|
|
466
|
-
#
|
479
|
+
# MailboxACLItem represents the data of an untagged +ACL+ response.
|
467
480
|
#
|
468
|
-
#
|
481
|
+
# IMAP#getacl returns an array of MailboxACLItem objects.
|
469
482
|
#
|
470
|
-
#
|
471
|
-
# +ACL+
|
483
|
+
# == Required capability
|
484
|
+
# Requires +ACL+ [RFC4314[https://www.rfc-editor.org/rfc/rfc4314]]
|
485
|
+
# capability.
|
472
486
|
class MailboxACLItem < Struct.new(:user, :rights, :mailbox)
|
473
487
|
##
|
474
488
|
# method: mailbox
|
@@ -490,11 +504,12 @@ module Net
|
|
490
504
|
# The access rights the indicated #user has to the #mailbox.
|
491
505
|
end
|
492
506
|
|
493
|
-
#
|
494
|
-
#
|
495
|
-
#
|
496
|
-
# Returned by Net::IMAP#namespace, contained inside a Namespaces object.
|
507
|
+
# Namespace represents a _single_ namespace, contained inside a Namespaces
|
508
|
+
# object.
|
497
509
|
#
|
510
|
+
# == Required capability
|
511
|
+
# Requires either +NAMESPACE+ [RFC2342[https://www.rfc-editor.org/rfc/rfc2342]]
|
512
|
+
# or +IMAP4rev2+ capability.
|
498
513
|
class Namespace < Struct.new(:prefix, :delim, :extensions)
|
499
514
|
##
|
500
515
|
# method: prefix
|
@@ -516,11 +531,14 @@ module Net
|
|
516
531
|
# Extension parameter semantics would be defined by the extension.
|
517
532
|
end
|
518
533
|
|
519
|
-
#
|
520
|
-
#
|
534
|
+
# Namespaces represents the data of an untagged +NAMESPACE+ response,
|
535
|
+
# returned by IMAP#namespace.
|
521
536
|
#
|
522
|
-
#
|
537
|
+
# Contains lists of #personal, #shared, and #other namespaces.
|
523
538
|
#
|
539
|
+
# == Required capability
|
540
|
+
# Requires either +NAMESPACE+ [RFC2342[https://www.rfc-editor.org/rfc/rfc2342]]
|
541
|
+
# or +IMAP4rev2+ capability.
|
524
542
|
class Namespaces < Struct.new(:personal, :other, :shared)
|
525
543
|
##
|
526
544
|
# method: personal
|
@@ -541,9 +559,9 @@ module Net
|
|
541
559
|
# Returns an array of Shared Namespace objects.
|
542
560
|
end
|
543
561
|
|
544
|
-
#
|
562
|
+
# StatusData represents the contents of an untagged +STATUS+ response.
|
545
563
|
#
|
546
|
-
#
|
564
|
+
# IMAP#status returns the contents of #attr.
|
547
565
|
class StatusData < Struct.new(:mailbox, :attr)
|
548
566
|
##
|
549
567
|
# method: mailbox
|
@@ -564,11 +582,11 @@ module Net
|
|
564
582
|
# [Note]
|
565
583
|
# When the #sender and #reply_to fields are absent or empty, they will
|
566
584
|
# return the same value as #from. Also, fields may return values that are
|
567
|
-
# invalid for well-formed [RFC5322[https://
|
585
|
+
# invalid for well-formed [RFC5322[https://www.rfc-editor.org/rfc/rfc5322]]
|
568
586
|
# messages when the message is malformed or a draft message.
|
569
587
|
#
|
570
|
-
# See [{IMAP4rev1 §7.4.2}[https://www.rfc-editor.org/rfc/rfc3501
|
571
|
-
# and [{IMAP4rev2 §7.5.2}[https://www.rfc-editor.org/rfc/rfc9051
|
588
|
+
# See [{IMAP4rev1 §7.4.2}[https://www.rfc-editor.org/rfc/rfc3501#section-7.4.2]]
|
589
|
+
# and [{IMAP4rev2 §7.5.2}[https://www.rfc-editor.org/rfc/rfc9051#section-7.5.2]]
|
572
590
|
# for full description of the envelope fields, and
|
573
591
|
# Net::IMAP@Message+envelope+and+body+structure for other relevant RFCs.
|
574
592
|
#
|
@@ -582,7 +600,7 @@ module Net
|
|
582
600
|
# Returns a string that represents the +Date+ header.
|
583
601
|
#
|
584
602
|
# [Note]
|
585
|
-
# For a well-formed [RFC5322[https://
|
603
|
+
# For a well-formed [RFC5322[https://www.rfc-editor.org/rfc/rfc5322]]
|
586
604
|
# message, the #date field must not be +nil+. However it can be +nil+
|
587
605
|
# for a malformed or draft message.
|
588
606
|
|
@@ -608,7 +626,7 @@ module Net
|
|
608
626
|
# returns +nil+ for this envelope field.
|
609
627
|
#
|
610
628
|
# [Note]
|
611
|
-
# For a well-formed [RFC5322[https://
|
629
|
+
# For a well-formed [RFC5322[https://www.rfc-editor.org/rfc/rfc5322]]
|
612
630
|
# message, the #from field must not be +nil+. However it can be +nil+
|
613
631
|
# for a malformed or draft message.
|
614
632
|
|
@@ -621,7 +639,7 @@ module Net
|
|
621
639
|
# [Note]
|
622
640
|
# If the <tt>Sender</tt> header is absent, or is present but empty, the
|
623
641
|
# server sets this field to be the same value as #from. Therefore, in a
|
624
|
-
# well-formed [RFC5322[https://
|
642
|
+
# well-formed [RFC5322[https://www.rfc-editor.org/rfc/rfc5322]] message,
|
625
643
|
# the #sender envelope field must not be +nil+. However it can be
|
626
644
|
# +nil+ for a malformed or draft message.
|
627
645
|
|
@@ -635,7 +653,7 @@ module Net
|
|
635
653
|
# [Note]
|
636
654
|
# If the <tt>Reply-To</tt> header is absent, or is present but empty,
|
637
655
|
# the server sets this field to be the same value as #from. Therefore,
|
638
|
-
# in a well-formed [RFC5322[https://
|
656
|
+
# in a well-formed [RFC5322[https://www.rfc-editor.org/rfc/rfc5322]]
|
639
657
|
# message, the #reply_to envelope field must not be +nil+. However it
|
640
658
|
# can be +nil+ for a malformed or draft message.
|
641
659
|
|
@@ -664,7 +682,7 @@ module Net
|
|
664
682
|
# Returns a string that represents the <tt>In-Reply-To</tt> header.
|
665
683
|
#
|
666
684
|
# [Note]
|
667
|
-
# For a well-formed [RFC5322[https://
|
685
|
+
# For a well-formed [RFC5322[https://www.rfc-editor.org/rfc/rfc5322]]
|
668
686
|
# message, the #in_reply_to field, if present, must not be empty. But
|
669
687
|
# it can still return an empty string for malformed messages.
|
670
688
|
#
|
@@ -680,7 +698,7 @@ module Net
|
|
680
698
|
# Returns a string that represents the <tt>Message-ID</tt>.
|
681
699
|
#
|
682
700
|
# [Note]
|
683
|
-
# For a well-formed [RFC5322[https://
|
701
|
+
# For a well-formed [RFC5322[https://www.rfc-editor.org/rfc/rfc5322]]
|
684
702
|
# message, the #message_id field, if present, must not be empty. But it
|
685
703
|
# can still return an empty string for malformed messages.
|
686
704
|
#
|
@@ -694,10 +712,10 @@ module Net
|
|
694
712
|
# parsed into its component parts by the server. Address objects are
|
695
713
|
# returned within Envelope fields.
|
696
714
|
#
|
697
|
-
#
|
715
|
+
# == Group syntax
|
698
716
|
#
|
699
717
|
# When the #host field is +nil+, this is a special form of address structure
|
700
|
-
# that indicates the [RFC5322[https://
|
718
|
+
# that indicates the [RFC5322[https://www.rfc-editor.org/rfc/rfc5322]] group
|
701
719
|
# syntax. If the #mailbox name field is also +nil+, this is an end-of-group
|
702
720
|
# marker (semicolon in RFC-822 syntax). If the #mailbox name field is
|
703
721
|
# non-+NIL+, this is the start of a group marker, and the mailbox #name
|
@@ -707,7 +725,7 @@ module Net
|
|
707
725
|
# method: name
|
708
726
|
# :call-seq: name -> string or nil
|
709
727
|
#
|
710
|
-
# Returns the [RFC5322[https://
|
728
|
+
# Returns the [RFC5322[https://www.rfc-editor.org/rfc/rfc5322]] address
|
711
729
|
# +display-name+ (or the mailbox +phrase+ in the RFC-822 grammar).
|
712
730
|
|
713
731
|
##
|
@@ -717,28 +735,28 @@ module Net
|
|
717
735
|
# Returns the route from RFC-822 route-addr.
|
718
736
|
#
|
719
737
|
# Note:: Generating this obsolete route addressing syntax is not allowed
|
720
|
-
# by [RFC5322[https://
|
738
|
+
# by [RFC5322[https://www.rfc-editor.org/rfc/rfc5322]]. However,
|
721
739
|
# addresses with this syntax must still be accepted and parsed.
|
722
740
|
|
723
741
|
##
|
724
742
|
# method: mailbox
|
725
743
|
# :call-seq: mailbox -> string or nil
|
726
744
|
#
|
727
|
-
# Returns the [RFC5322[https://
|
745
|
+
# Returns the [RFC5322[https://www.rfc-editor.org/rfc/rfc5322]] address
|
728
746
|
# +local-part+, if #host is not +nil+.
|
729
747
|
#
|
730
748
|
# When #host is +nil+, this returns
|
731
|
-
# an [RFC5322[https://
|
749
|
+
# an [RFC5322[https://www.rfc-editor.org/rfc/rfc5322]] group name and a +nil+
|
732
750
|
# mailbox indicates the end of a group.
|
733
751
|
|
734
752
|
##
|
735
753
|
# method: host
|
736
754
|
# :call-seq: host -> string or nil
|
737
755
|
#
|
738
|
-
# Returns the [RFC5322[https://
|
756
|
+
# Returns the [RFC5322[https://www.rfc-editor.org/rfc/rfc5322]] addr-spec
|
739
757
|
# +domain+ name.
|
740
758
|
#
|
741
|
-
# +nil+ indicates [RFC5322[https://
|
759
|
+
# +nil+ indicates [RFC5322[https://www.rfc-editor.org/rfc/rfc5322]] group
|
742
760
|
# syntax.
|
743
761
|
end
|
744
762
|
|
@@ -750,14 +768,14 @@ module Net
|
|
750
768
|
# :call-seq: dsp_type -> string
|
751
769
|
#
|
752
770
|
# Returns the content disposition type, as defined by
|
753
|
-
# [DISPOSITION[https://
|
771
|
+
# [DISPOSITION[https://www.rfc-editor.org/rfc/rfc2183]].
|
754
772
|
|
755
773
|
##
|
756
774
|
# method: param
|
757
775
|
# :call-seq: param -> hash
|
758
776
|
#
|
759
777
|
# Returns a hash representing parameters of the Content-Disposition
|
760
|
-
# field, as defined by [DISPOSITION[https://
|
778
|
+
# field, as defined by [DISPOSITION[https://www.rfc-editor.org/rfc/rfc2183]].
|
761
779
|
end
|
762
780
|
|
763
781
|
# Net::IMAP::ThreadMember represents a thread-node returned
|
@@ -796,12 +814,12 @@ module Net
|
|
796
814
|
# FetchData#attr value. Although these classes don't share a base class,
|
797
815
|
# this module can be used to pattern match all of them.
|
798
816
|
#
|
799
|
-
# See {[IMAP4rev1] §7.4.2}[https://www.rfc-editor.org/rfc/rfc3501
|
800
|
-
# and {[IMAP4rev2] §7.5.2}[https://www.rfc-editor.org/rfc/rfc9051
|
817
|
+
# See {[IMAP4rev1] §7.4.2}[https://www.rfc-editor.org/rfc/rfc3501#section-7.4.2]
|
818
|
+
# and {[IMAP4rev2] §7.5.2}[https://www.rfc-editor.org/rfc/rfc9051#section-7.5.2-4.9]
|
801
819
|
# for full description of all +BODYSTRUCTURE+ fields, and also
|
802
820
|
# Net::IMAP@Message+envelope+and+body+structure for other relevant RFCs.
|
803
821
|
#
|
804
|
-
#
|
822
|
+
# == Classes that include BodyStructure
|
805
823
|
# BodyTypeBasic:: Represents any message parts that are not handled by
|
806
824
|
# BodyTypeText, BodyTypeMessage, or BodyTypeMultipart.
|
807
825
|
# BodyTypeText:: Used by <tt>text/*</tt> parts. Contains all of the
|
@@ -819,8 +837,8 @@ module Net
|
|
819
837
|
# message parts, unless they have a <tt>Content-Type</tt> that is handled by
|
820
838
|
# BodyTypeText, BodyTypeMessage, or BodyTypeMultipart.
|
821
839
|
#
|
822
|
-
# See {[IMAP4rev1] §7.4.2}[https://www.rfc-editor.org/rfc/rfc3501
|
823
|
-
# and {[IMAP4rev2] §7.5.2}[https://www.rfc-editor.org/rfc/rfc9051
|
840
|
+
# See {[IMAP4rev1] §7.4.2}[https://www.rfc-editor.org/rfc/rfc3501#section-7.4.2]
|
841
|
+
# and {[IMAP4rev2] §7.5.2}[https://www.rfc-editor.org/rfc/rfc9051#section-7.5.2-4.9]
|
824
842
|
# for full description of all +BODYSTRUCTURE+ fields, and also
|
825
843
|
# Net::IMAP@Message+envelope+and+body+structure for other relevant RFCs.
|
826
844
|
#
|
@@ -837,45 +855,45 @@ module Net
|
|
837
855
|
# :call-seq: media_type -> string
|
838
856
|
#
|
839
857
|
# The top-level media type as defined in
|
840
|
-
# [MIME-IMB[https://
|
858
|
+
# [MIME-IMB[https://www.rfc-editor.org/rfc/rfc2045]].
|
841
859
|
|
842
860
|
##
|
843
861
|
# method: subtype
|
844
862
|
# :call-seq: subtype -> string
|
845
863
|
#
|
846
864
|
# The media subtype name as defined in
|
847
|
-
# [MIME-IMB[https://
|
865
|
+
# [MIME-IMB[https://www.rfc-editor.org/rfc/rfc2045]].
|
848
866
|
|
849
867
|
##
|
850
868
|
# method: param
|
851
869
|
# :call-seq: param -> string
|
852
870
|
#
|
853
871
|
# Returns a hash that represents parameters as defined in
|
854
|
-
# [MIME-IMB[https://
|
872
|
+
# [MIME-IMB[https://www.rfc-editor.org/rfc/rfc2045]].
|
855
873
|
|
856
874
|
##
|
857
875
|
# method: content_id
|
858
876
|
# :call-seq: content_id -> string
|
859
877
|
#
|
860
878
|
# Returns a string giving the content id as defined
|
861
|
-
# in [MIME-IMB[https://
|
862
|
-
# {§7}[https://
|
879
|
+
# in [MIME-IMB[https://www.rfc-editor.org/rfc/rfc2045]]
|
880
|
+
# {§7}[https://www.rfc-editor.org/rfc/rfc2045#section-7].
|
863
881
|
|
864
882
|
##
|
865
883
|
# method: description
|
866
884
|
# :call-seq: description -> string
|
867
885
|
#
|
868
886
|
# Returns a string giving the content description as defined
|
869
|
-
# in [MIME-IMB[https://
|
870
|
-
# {§8}[https://
|
887
|
+
# in [MIME-IMB[https://www.rfc-editor.org/rfc/rfc2045]]
|
888
|
+
# {§8}[https://www.rfc-editor.org/rfc/rfc2045#section-8].
|
871
889
|
|
872
890
|
##
|
873
891
|
# method: encoding
|
874
892
|
# :call-seq: encoding -> string
|
875
893
|
#
|
876
894
|
# Returns a string giving the content transfer encoding as defined
|
877
|
-
# in [MIME-IMB[https://
|
878
|
-
# {§6}[https://
|
895
|
+
# in [MIME-IMB[https://www.rfc-editor.org/rfc/rfc2045]]
|
896
|
+
# {§6}[https://www.rfc-editor.org/rfc/rfc2045#section-6].
|
879
897
|
|
880
898
|
##
|
881
899
|
# method: size
|
@@ -888,7 +906,7 @@ module Net
|
|
888
906
|
# :call-seq: md5 -> string
|
889
907
|
#
|
890
908
|
# Returns a string giving the body MD5 value as defined in
|
891
|
-
# [MD5[https://
|
909
|
+
# [MD5[https://www.rfc-editor.org/rfc/rfc1864]].
|
892
910
|
|
893
911
|
##
|
894
912
|
# method: disposition
|
@@ -896,7 +914,7 @@ module Net
|
|
896
914
|
#
|
897
915
|
# Returns a ContentDisposition object giving the content
|
898
916
|
# disposition, as defined by
|
899
|
-
# [DISPOSITION[https://
|
917
|
+
# [DISPOSITION[https://www.rfc-editor.org/rfc/rfc2183]].
|
900
918
|
|
901
919
|
##
|
902
920
|
# method: language
|
@@ -1064,7 +1082,7 @@ module Net
|
|
1064
1082
|
# call-seq: subtype -> string
|
1065
1083
|
#
|
1066
1084
|
# Returns the content subtype name
|
1067
|
-
# as defined in [MIME-IMB[https://
|
1085
|
+
# as defined in [MIME-IMB[https://www.rfc-editor.org/rfc/rfc2045]].
|
1068
1086
|
|
1069
1087
|
##
|
1070
1088
|
# method: parts
|
@@ -1078,7 +1096,7 @@ module Net
|
|
1078
1096
|
# call-seq: param -> hash
|
1079
1097
|
#
|
1080
1098
|
# Returns a hash that represents parameters
|
1081
|
-
# as defined in [MIME-IMB[https://
|
1099
|
+
# as defined in [MIME-IMB[https://www.rfc-editor.org/rfc/rfc2045]].
|
1082
1100
|
|
1083
1101
|
##
|
1084
1102
|
# method: disposition
|
@@ -734,7 +734,7 @@ module Net
|
|
734
734
|
when "EXISTS" then mailbox_data__exists # RFC3501, RFC9051
|
735
735
|
when "ESEARCH" then esearch_response # RFC4731, RFC9051, etc
|
736
736
|
when "VANISHED" then expunged_resp # RFC7162
|
737
|
-
when "UIDFETCH" then uidfetch_resp #
|
737
|
+
when "UIDFETCH" then uidfetch_resp # RFC9586
|
738
738
|
when "SEARCH" then mailbox_data__search # RFC3501 (obsolete)
|
739
739
|
when "CAPABILITY" then capability_data__untagged # RFC3501, RFC9051
|
740
740
|
when "FLAGS" then mailbox_data__flags # RFC3501, RFC9051
|
@@ -787,7 +787,6 @@ module Net
|
|
787
787
|
def response_data__ignored; response_data__unhandled(IgnoredResponse) end
|
788
788
|
alias response_data__noop response_data__ignored
|
789
789
|
|
790
|
-
alias uidfetch_resp response_data__unhandled
|
791
790
|
alias listrights_data response_data__unhandled
|
792
791
|
alias myrights_data response_data__unhandled
|
793
792
|
alias metadata_resp response_data__unhandled
|
@@ -848,6 +847,14 @@ module Net
|
|
848
847
|
UntaggedResponse.new(name, data, @str)
|
849
848
|
end
|
850
849
|
|
850
|
+
# uidfetch-resp = uniqueid SP "UIDFETCH" SP msg-att
|
851
|
+
def uidfetch_resp
|
852
|
+
uid = uniqueid; SP!
|
853
|
+
name = label "UIDFETCH"; SP!
|
854
|
+
data = UIDFetchData.new(uid, msg_att(uid))
|
855
|
+
UntaggedResponse.new(name, data, @str)
|
856
|
+
end
|
857
|
+
|
851
858
|
def response_data__simple_numeric
|
852
859
|
data = nz_number; SP!
|
853
860
|
name = tagged_ext_label
|
@@ -1935,6 +1942,9 @@ module Net
|
|
1935
1942
|
#
|
1936
1943
|
# RFC8474: OBJECTID
|
1937
1944
|
# resp-text-code =/ "MAILBOXID" SP "(" objectid ")"
|
1945
|
+
#
|
1946
|
+
# RFC9586: UIDONLY
|
1947
|
+
# resp-text-code =/ "UIDREQUIRED"
|
1938
1948
|
def resp_text_code
|
1939
1949
|
name = resp_text_code__name
|
1940
1950
|
data =
|
@@ -1957,6 +1967,7 @@ module Net
|
|
1957
1967
|
when "HIGHESTMODSEQ" then SP!; mod_sequence_value # CONDSTORE
|
1958
1968
|
when "MODIFIED" then SP!; sequence_set # CONDSTORE
|
1959
1969
|
when "MAILBOXID" then SP!; parens__objectid # RFC8474: OBJECTID
|
1970
|
+
when "UIDREQUIRED" then # RFC9586: UIDONLY
|
1960
1971
|
else
|
1961
1972
|
SP? and text_chars_except_rbra
|
1962
1973
|
end
|
@@ -5,7 +5,7 @@ module Net
|
|
5
5
|
module SASL
|
6
6
|
|
7
7
|
# Authenticator for the "+ANONYMOUS+" SASL mechanism, as specified by
|
8
|
-
# RFC-4505[https://
|
8
|
+
# RFC-4505[https://www.rfc-editor.org/rfc/rfc4505]. See
|
9
9
|
# Net::IMAP#authenticate.
|
10
10
|
class AnonymousAuthenticator
|
11
11
|
|
@@ -13,7 +13,7 @@ module Net
|
|
13
13
|
# characters in length.
|
14
14
|
#
|
15
15
|
# If it contains an "@" sign, the message must be a valid email address
|
16
|
-
# (+addr-spec+ from RFC-2822[https://
|
16
|
+
# (+addr-spec+ from RFC-2822[https://www.rfc-editor.org/rfc/rfc2822]).
|
17
17
|
# Email syntax is _not_ validated by AnonymousAuthenticator.
|
18
18
|
#
|
19
19
|
# Otherwise, it can be any UTF8 string which is permitted by the
|
@@ -25,7 +25,7 @@ module Net
|
|
25
25
|
# new(anonymous_message: "", **) -> authenticator
|
26
26
|
#
|
27
27
|
# Creates an Authenticator for the "+ANONYMOUS+" SASL mechanism, as
|
28
|
-
# specified in RFC-4505[https://
|
28
|
+
# specified in RFC-4505[https://www.rfc-editor.org/rfc/rfc4505]. To use
|
29
29
|
# this, see Net::IMAP#authenticate or your client's authentication
|
30
30
|
# method.
|
31
31
|
#
|