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.

data/lib/net/imap.rb CHANGED
@@ -25,8 +25,8 @@ module Net
25
25
 
26
26
  # Net::IMAP implements Internet Message Access Protocol (\IMAP) client
27
27
  # functionality. The protocol is described
28
- # in {IMAP4rev1 [RFC3501]}[https://tools.ietf.org/html/rfc3501]
29
- # and {IMAP4rev2 [RFC9051]}[https://tools.ietf.org/html/rfc9051].
28
+ # in {IMAP4rev1 [RFC3501]}[https://www.rfc-editor.org/rfc/rfc3501]
29
+ # and {IMAP4rev2 [RFC9051]}[https://www.rfc-editor.org/rfc/rfc9051].
30
30
  #
31
31
  # == \IMAP Overview
32
32
  #
@@ -299,15 +299,15 @@ module Net
299
299
  # === Core \IMAP commands
300
300
  #
301
301
  # The following commands are defined either by
302
- # the [IMAP4rev1[https://tools.ietf.org/html/rfc3501]] base specification, or
302
+ # the [IMAP4rev1[https://www.rfc-editor.org/rfc/rfc3501]] base specification, or
303
303
  # by one of the following extensions:
304
- # [IDLE[https://tools.ietf.org/html/rfc2177]],
305
- # [NAMESPACE[https://tools.ietf.org/html/rfc2342]],
306
- # [UNSELECT[https://tools.ietf.org/html/rfc3691]],
307
- # [ENABLE[https://tools.ietf.org/html/rfc5161]],
308
- # [MOVE[https://tools.ietf.org/html/rfc6851]].
304
+ # [IDLE[https://www.rfc-editor.org/rfc/rfc2177]],
305
+ # [NAMESPACE[https://www.rfc-editor.org/rfc/rfc2342]],
306
+ # [UNSELECT[https://www.rfc-editor.org/rfc/rfc3691]],
307
+ # [ENABLE[https://www.rfc-editor.org/rfc/rfc5161]],
308
+ # [MOVE[https://www.rfc-editor.org/rfc/rfc6851]].
309
309
  # These extensions are widely supported by modern IMAP4rev1 servers and have
310
- # all been integrated into [IMAP4rev2[https://tools.ietf.org/html/rfc9051]].
310
+ # all been integrated into [IMAP4rev2[https://www.rfc-editor.org/rfc/rfc9051]].
311
311
  # <em>*NOTE:* Net::IMAP doesn't support IMAP4rev2 yet.</em>
312
312
  #
313
313
  # ==== Any state
@@ -404,7 +404,7 @@ module Net
404
404
  #
405
405
  # ==== RFC9051: +IMAP4rev2+
406
406
  #
407
- # Although IMAP4rev2[https://tools.ietf.org/html/rfc9051] is not supported
407
+ # Although IMAP4rev2[https://www.rfc-editor.org/rfc/rfc9051] is not supported
408
408
  # yet, Net::IMAP supports several extensions that have been folded into it:
409
409
  # +ENABLE+, +IDLE+, +MOVE+, +NAMESPACE+, +SASL-IR+, +UIDPLUS+, +UNSELECT+,
410
410
  # <tt>STATUS=SIZE</tt>, and the fetch side of +BINARY+.
@@ -424,13 +424,13 @@ module Net
424
424
  # - #setquota: sets the resource limits for a given quota root.
425
425
  #
426
426
  # ==== RFC2177: +IDLE+
427
- # Folded into IMAP4rev2[https://tools.ietf.org/html/rfc9051] and also included
427
+ # Folded into IMAP4rev2[https://www.rfc-editor.org/rfc/rfc9051] and also included
428
428
  # above with {Core IMAP commands}[rdoc-ref:Net::IMAP@Core+IMAP+commands].
429
429
  # - #idle: Allows the server to send updates to the client, without the client
430
430
  # needing to poll using #noop.
431
431
  #
432
432
  # ==== RFC2342: +NAMESPACE+
433
- # Folded into IMAP4rev2[https://tools.ietf.org/html/rfc9051] and also included
433
+ # Folded into IMAP4rev2[https://www.rfc-editor.org/rfc/rfc9051] and also included
434
434
  # above with {Core IMAP commands}[rdoc-ref:Net::IMAP@Core+IMAP+commands].
435
435
  # - #namespace: Returns mailbox namespaces, with path prefixes and delimiters.
436
436
  #
@@ -439,7 +439,7 @@ module Net
439
439
  #
440
440
  # ==== RFC3516: +BINARY+
441
441
  # The fetch side of +BINARY+ has been folded into
442
- # IMAP4rev2[https://tools.ietf.org/html/rfc9051].
442
+ # IMAP4rev2[https://www.rfc-editor.org/rfc/rfc9051].
443
443
  # - Updates #fetch and #uid_fetch with the +BINARY+, +BINARY.PEEK+, and
444
444
  # +BINARY.SIZE+ items. See FetchData#binary and FetchData#binary_size.
445
445
  #
@@ -447,7 +447,7 @@ module Net
447
447
  # *NOTE:* The binary extension the #append command is _not_ supported yet.
448
448
  #
449
449
  # ==== RFC3691: +UNSELECT+
450
- # Folded into IMAP4rev2[https://tools.ietf.org/html/rfc9051] and also included
450
+ # Folded into IMAP4rev2[https://www.rfc-editor.org/rfc/rfc9051] and also included
451
451
  # above with {Core IMAP commands}[rdoc-ref:Net::IMAP@Core+IMAP+commands].
452
452
  # - #unselect: Closes the mailbox and returns to the "_authenticated_" state,
453
453
  # without expunging any messages.
@@ -459,7 +459,7 @@ module Net
459
459
  # *NOTE:* +DELETEACL+, +LISTRIGHTS+, and +MYRIGHTS+ are not supported yet.
460
460
  #
461
461
  # ==== RFC4315: +UIDPLUS+
462
- # Folded into IMAP4rev2[https://tools.ietf.org/html/rfc9051] and also included
462
+ # Folded into IMAP4rev2[https://www.rfc-editor.org/rfc/rfc9051] and also included
463
463
  # above with {Core IMAP commands}[rdoc-ref:Net::IMAP@Core+IMAP+commands].
464
464
  # - #uid_expunge: Restricts #expunge to only remove the specified UIDs.
465
465
  # - Updates #select, #examine with the +UIDNOTSTICKY+ ResponseCode
@@ -467,15 +467,15 @@ module Net
467
467
  # - Updates #copy, #move with the +COPYUID+ ResponseCode
468
468
  #
469
469
  # ==== RFC4731: +ESEARCH+
470
- # Folded into IMAP4rev2[https://tools.ietf.org/html/rfc9051].
470
+ # Folded into IMAP4rev2[https://www.rfc-editor.org/rfc/rfc9051].
471
471
  # - Updates #search, #uid_search with +return+ options and ESearchResult.
472
472
  #
473
473
  # ==== RFC4959: +SASL-IR+
474
- # Folded into IMAP4rev2[https://tools.ietf.org/html/rfc9051].
474
+ # Folded into IMAP4rev2[https://www.rfc-editor.org/rfc/rfc9051].
475
475
  # - Updates #authenticate with the option to send an initial response.
476
476
  #
477
477
  # ==== RFC5161: +ENABLE+
478
- # Folded into IMAP4rev2[https://tools.ietf.org/html/rfc9051] and also included
478
+ # Folded into IMAP4rev2[https://www.rfc-editor.org/rfc/rfc9051] and also included
479
479
  # above with {Core IMAP commands}[rdoc-ref:Net::IMAP@Core+IMAP+commands].
480
480
  # - #enable: Enables backwards incompatible server extensions.
481
481
  #
@@ -499,7 +499,7 @@ module Net
499
499
  # +X-GM-THRID+, but Gmail does not support it (as of 2023-11-10).
500
500
  #
501
501
  # ==== RFC6851: +MOVE+
502
- # Folded into IMAP4rev2[https://tools.ietf.org/html/rfc9051] and also included
502
+ # Folded into IMAP4rev2[https://www.rfc-editor.org/rfc/rfc9051] and also included
503
503
  # above with {Core IMAP commands}[rdoc-ref:Net::IMAP@Core+IMAP+commands].
504
504
  # - #move, #uid_move: Moves the specified messages to the end of the
505
505
  # specified destination mailbox, expunging them from the current mailbox.
@@ -539,6 +539,12 @@ module Net
539
539
  # ESearchResult#partial return data.
540
540
  # - Updates #uid_fetch with the +partial+ modifier.
541
541
  #
542
+ # ==== RFC9586: +UIDONLY+
543
+ # - Updates #enable with +UIDONLY+ parameter.
544
+ # - Updates #uid_fetch and #uid_store to return +UIDFETCH+ response.
545
+ # - Updates #expunge and #uid_expunge to return +VANISHED+ response.
546
+ # - Prohibits use of message sequence numbers in responses or requests.
547
+ #
542
548
  # == References
543
549
  #
544
550
  # [{IMAP4rev1}[https://www.rfc-editor.org/rfc/rfc3501.html]]::
@@ -569,57 +575,57 @@ module Net
569
575
  # Gahrns, M., "IMAP4 Multi-Accessed Mailbox Practice", RFC 2180, DOI
570
576
  # 10.17487/RFC2180, July 1997, <https://www.rfc-editor.org/info/rfc2180>.
571
577
  #
572
- # [UTF7[https://tools.ietf.org/html/rfc2152]]::
578
+ # [UTF7[https://www.rfc-editor.org/rfc/rfc2152]]::
573
579
  # Goldsmith, D. and M. Davis, "UTF-7 A Mail-Safe Transformation Format of
574
580
  # Unicode", RFC 2152, DOI 10.17487/RFC2152, May 1997,
575
581
  # <https://www.rfc-editor.org/info/rfc2152>.
576
582
  #
577
583
  # === Message envelope and body structure
578
584
  #
579
- # [RFC5322[https://tools.ietf.org/html/rfc5322]]::
585
+ # [RFC5322[https://www.rfc-editor.org/rfc/rfc5322]]::
580
586
  # Resnick, P., Ed., "Internet Message Format",
581
587
  # RFC 5322, DOI 10.17487/RFC5322, October 2008,
582
588
  # <https://www.rfc-editor.org/info/rfc5322>.
583
589
  #
584
590
  # <em>Note: obsoletes</em>
585
- # RFC-2822[https://tools.ietf.org/html/rfc2822]<em> (April 2001) and</em>
586
- # RFC-822[https://tools.ietf.org/html/rfc822]<em> (August 1982).</em>
591
+ # RFC-2822[https://www.rfc-editor.org/rfc/rfc2822]<em> (April 2001) and</em>
592
+ # RFC-822[https://www.rfc-editor.org/rfc/rfc822]<em> (August 1982).</em>
587
593
  #
588
- # [CHARSET[https://tools.ietf.org/html/rfc2978]]::
594
+ # [CHARSET[https://www.rfc-editor.org/rfc/rfc2978]]::
589
595
  # Freed, N. and J. Postel, "IANA Charset Registration Procedures", BCP 19,
590
596
  # RFC 2978, DOI 10.17487/RFC2978, October 2000,
591
597
  # <https://www.rfc-editor.org/info/rfc2978>.
592
598
  #
593
- # [DISPOSITION[https://tools.ietf.org/html/rfc2183]]::
599
+ # [DISPOSITION[https://www.rfc-editor.org/rfc/rfc2183]]::
594
600
  # Troost, R., Dorner, S., and K. Moore, Ed., "Communicating Presentation
595
601
  # Information in Internet Messages: The Content-Disposition Header
596
602
  # Field", RFC 2183, DOI 10.17487/RFC2183, August 1997,
597
603
  # <https://www.rfc-editor.org/info/rfc2183>.
598
604
  #
599
- # [MIME-IMB[https://tools.ietf.org/html/rfc2045]]::
605
+ # [MIME-IMB[https://www.rfc-editor.org/rfc/rfc2045]]::
600
606
  # Freed, N. and N. Borenstein, "Multipurpose Internet Mail Extensions
601
607
  # (MIME) Part One: Format of Internet Message Bodies",
602
608
  # RFC 2045, DOI 10.17487/RFC2045, November 1996,
603
609
  # <https://www.rfc-editor.org/info/rfc2045>.
604
610
  #
605
- # [MIME-IMT[https://tools.ietf.org/html/rfc2046]]::
611
+ # [MIME-IMT[https://www.rfc-editor.org/rfc/rfc2046]]::
606
612
  # Freed, N. and N. Borenstein, "Multipurpose Internet Mail Extensions
607
613
  # (MIME) Part Two: Media Types", RFC 2046, DOI 10.17487/RFC2046,
608
614
  # November 1996, <https://www.rfc-editor.org/info/rfc2046>.
609
615
  #
610
- # [MIME-HDRS[https://tools.ietf.org/html/rfc2047]]::
616
+ # [MIME-HDRS[https://www.rfc-editor.org/rfc/rfc2047]]::
611
617
  # Moore, K., "MIME (Multipurpose Internet Mail Extensions) Part Three:
612
618
  # Message Header Extensions for Non-ASCII Text",
613
619
  # RFC 2047, DOI 10.17487/RFC2047, November 1996,
614
620
  # <https://www.rfc-editor.org/info/rfc2047>.
615
621
  #
616
- # [RFC2231[https://tools.ietf.org/html/rfc2231]]::
622
+ # [RFC2231[https://www.rfc-editor.org/rfc/rfc2231]]::
617
623
  # Freed, N. and K. Moore, "MIME Parameter Value and Encoded Word
618
624
  # Extensions: Character Sets, Languages, and Continuations",
619
625
  # RFC 2231, DOI 10.17487/RFC2231, November 1997,
620
626
  # <https://www.rfc-editor.org/info/rfc2231>.
621
627
  #
622
- # [I18n-HDRS[https://tools.ietf.org/html/rfc6532]]::
628
+ # [I18n-HDRS[https://www.rfc-editor.org/rfc/rfc6532]]::
623
629
  # Yang, A., Steele, S., and N. Freed, "Internationalized Email Headers",
624
630
  # RFC 6532, DOI 10.17487/RFC6532, February 2012,
625
631
  # <https://www.rfc-editor.org/info/rfc6532>.
@@ -635,12 +641,12 @@ module Net
635
641
  # RFC 2557, DOI 10.17487/RFC2557, March 1999,
636
642
  # <https://www.rfc-editor.org/info/rfc2557>.
637
643
  #
638
- # [MD5[https://tools.ietf.org/html/rfc1864]]::
644
+ # [MD5[https://www.rfc-editor.org/rfc/rfc1864]]::
639
645
  # Myers, J. and M. Rose, "The Content-MD5 Header Field",
640
646
  # RFC 1864, DOI 10.17487/RFC1864, October 1995,
641
647
  # <https://www.rfc-editor.org/info/rfc1864>.
642
648
  #
643
- # [RFC3503[https://tools.ietf.org/html/rfc3503]]::
649
+ # [RFC3503[https://www.rfc-editor.org/rfc/rfc3503]]::
644
650
  # Melnikov, A., "Message Disposition Notification (MDN)
645
651
  # profile for Internet Message Access Protocol (IMAP)",
646
652
  # RFC 3503, DOI 10.17487/RFC3503, March 2003,
@@ -648,27 +654,27 @@ module Net
648
654
  #
649
655
  # === \IMAP Extensions
650
656
  #
651
- # [QUOTA[https://tools.ietf.org/html/rfc9208]]::
657
+ # [QUOTA[https://www.rfc-editor.org/rfc/rfc9208]]::
652
658
  # Melnikov, A., "IMAP QUOTA Extension", RFC 9208, DOI 10.17487/RFC9208,
653
659
  # March 2022, <https://www.rfc-editor.org/info/rfc9208>.
654
660
  #
655
661
  # <em>Note: obsoletes</em>
656
- # RFC-2087[https://tools.ietf.org/html/rfc2087]<em> (January 1997)</em>.
662
+ # RFC-2087[https://www.rfc-editor.org/rfc/rfc2087]<em> (January 1997)</em>.
657
663
  # <em>Net::IMAP does not fully support the RFC9208 updates yet.</em>
658
- # [IDLE[https://tools.ietf.org/html/rfc2177]]::
664
+ # [IDLE[https://www.rfc-editor.org/rfc/rfc2177]]::
659
665
  # Leiba, B., "IMAP4 IDLE command", RFC 2177, DOI 10.17487/RFC2177,
660
666
  # June 1997, <https://www.rfc-editor.org/info/rfc2177>.
661
- # [NAMESPACE[https://tools.ietf.org/html/rfc2342]]::
667
+ # [NAMESPACE[https://www.rfc-editor.org/rfc/rfc2342]]::
662
668
  # Gahrns, M. and C. Newman, "IMAP4 Namespace", RFC 2342,
663
669
  # DOI 10.17487/RFC2342, May 1998, <https://www.rfc-editor.org/info/rfc2342>.
664
- # [ID[https://tools.ietf.org/html/rfc2971]]::
670
+ # [ID[https://www.rfc-editor.org/rfc/rfc2971]]::
665
671
  # Showalter, T., "IMAP4 ID extension", RFC 2971, DOI 10.17487/RFC2971,
666
672
  # October 2000, <https://www.rfc-editor.org/info/rfc2971>.
667
- # [BINARY[https://tools.ietf.org/html/rfc3516]]::
673
+ # [BINARY[https://www.rfc-editor.org/rfc/rfc3516]]::
668
674
  # Nerenberg, L., "IMAP4 Binary Content Extension", RFC 3516,
669
675
  # DOI 10.17487/RFC3516, April 2003,
670
676
  # <https://www.rfc-editor.org/info/rfc3516>.
671
- # [ACL[https://tools.ietf.org/html/rfc4314]]::
677
+ # [ACL[https://www.rfc-editor.org/rfc/rfc4314]]::
672
678
  # Melnikov, A., "IMAP4 Access Control List (ACL) Extension", RFC 4314,
673
679
  # DOI 10.17487/RFC4314, December 2005,
674
680
  # <https://www.rfc-editor.org/info/rfc4314>.
@@ -676,33 +682,33 @@ module Net
676
682
  # Crispin, M., "Internet Message Access Protocol (\IMAP) - UIDPLUS
677
683
  # extension", RFC 4315, DOI 10.17487/RFC4315, December 2005,
678
684
  # <https://www.rfc-editor.org/info/rfc4315>.
679
- # [SORT[https://tools.ietf.org/html/rfc5256]]::
685
+ # [SORT[https://www.rfc-editor.org/rfc/rfc5256]]::
680
686
  # Crispin, M. and K. Murchison, "Internet Message Access Protocol - SORT and
681
687
  # THREAD Extensions", RFC 5256, DOI 10.17487/RFC5256, June 2008,
682
688
  # <https://www.rfc-editor.org/info/rfc5256>.
683
- # [THREAD[https://tools.ietf.org/html/rfc5256]]::
689
+ # [THREAD[https://www.rfc-editor.org/rfc/rfc5256]]::
684
690
  # Crispin, M. and K. Murchison, "Internet Message Access Protocol - SORT and
685
691
  # THREAD Extensions", RFC 5256, DOI 10.17487/RFC5256, June 2008,
686
692
  # <https://www.rfc-editor.org/info/rfc5256>.
687
693
  # [RFC5530[https://www.rfc-editor.org/rfc/rfc5530.html]]::
688
694
  # Gulbrandsen, A., "IMAP Response Codes", RFC 5530, DOI 10.17487/RFC5530,
689
695
  # May 2009, <https://www.rfc-editor.org/info/rfc5530>.
690
- # [MOVE[https://tools.ietf.org/html/rfc6851]]::
696
+ # [MOVE[https://www.rfc-editor.org/rfc/rfc6851]]::
691
697
  # Gulbrandsen, A. and N. Freed, Ed., "Internet Message Access Protocol
692
698
  # (\IMAP) - MOVE Extension", RFC 6851, DOI 10.17487/RFC6851, January 2013,
693
699
  # <https://www.rfc-editor.org/info/rfc6851>.
694
- # [UTF8=ACCEPT[https://tools.ietf.org/html/rfc6855]]::
695
- # [UTF8=ONLY[https://tools.ietf.org/html/rfc6855]]::
700
+ # [UTF8=ACCEPT[https://www.rfc-editor.org/rfc/rfc6855]]::
701
+ # [UTF8=ONLY[https://www.rfc-editor.org/rfc/rfc6855]]::
696
702
  # Resnick, P., Ed., Newman, C., Ed., and S. Shen, Ed.,
697
703
  # "IMAP Support for UTF-8", RFC 6855, DOI 10.17487/RFC6855, March 2013,
698
704
  # <https://www.rfc-editor.org/info/rfc6855>.
699
- # [CONDSTORE[https://tools.ietf.org/html/rfc7162]]::
700
- # [QRESYNC[https://tools.ietf.org/html/rfc7162]]::
705
+ # [CONDSTORE[https://www.rfc-editor.org/rfc/rfc7162]]::
706
+ # [QRESYNC[https://www.rfc-editor.org/rfc/rfc7162]]::
701
707
  # Melnikov, A. and D. Cridland, "IMAP Extensions: Quick Flag Changes
702
708
  # Resynchronization (CONDSTORE) and Quick Mailbox Resynchronization
703
709
  # (QRESYNC)", RFC 7162, DOI 10.17487/RFC7162, May 2014,
704
710
  # <https://www.rfc-editor.org/info/rfc7162>.
705
- # [OBJECTID[https://tools.ietf.org/html/rfc8474]]::
711
+ # [OBJECTID[https://www.rfc-editor.org/rfc/rfc8474]]::
706
712
  # Gondwana, B., Ed., "IMAP Extension for Object Identifiers",
707
713
  # RFC 8474, DOI 10.17487/RFC8474, September 2018,
708
714
  # <https://www.rfc-editor.org/info/rfc8474>.
@@ -711,6 +717,11 @@ module Net
711
717
  # "IMAP PARTIAL Extension for Paged SEARCH and FETCH", RFC 9394,
712
718
  # DOI 10.17487/RFC9394, June 2023,
713
719
  # <https://www.rfc-editor.org/info/rfc9394>.
720
+ # [UIDONLY[https://www.rfc-editor.org/rfc/rfc9586.pdf]]::
721
+ # Melnikov, A., Achuthan, A., Nagulakonda, V., Singh, A., and L. Alves,
722
+ # "\IMAP Extension for Using and Returning Unique Identifiers (UIDs) Only",
723
+ # RFC 9586, DOI 10.17487/RFC9586, May 2024,
724
+ # <https://www.rfc-editor.org/info/rfc9586>.
714
725
  #
715
726
  # === IANA registries
716
727
  # * {IMAP Capabilities}[http://www.iana.org/assignments/imap4-capabilities]
@@ -724,7 +735,7 @@ module Net
724
735
  # * {GSSAPI/Kerberos/SASL Service Names}[https://www.iana.org/assignments/gssapi-service-names/gssapi-service-names.xhtml]:
725
736
  # +imap+
726
737
  # * {Character sets}[https://www.iana.org/assignments/character-sets/character-sets.xhtml]
727
- # ===== For currently unsupported features:
738
+ # ==== For currently unsupported features:
728
739
  # * {IMAP Quota Resource Types}[http://www.iana.org/assignments/imap4-capabilities#imap-capabilities-2]
729
740
  # * {LIST-EXTENDED options and responses}[https://www.iana.org/assignments/imap-list-extended/imap-list-extended.xhtml]
730
741
  # * {IMAP METADATA Server Entry and Mailbox Entry Registries}[https://www.iana.org/assignments/imap-metadata/imap-metadata.xhtml]
@@ -733,7 +744,7 @@ module Net
733
744
  # * {IMAP URLAUTH Authorization Mechanism Registry}[https://www.iana.org/assignments/urlauth-authorization-mechanism-registry/urlauth-authorization-mechanism-registry.xhtml]
734
745
  #
735
746
  class IMAP < Protocol
736
- VERSION = "0.5.4"
747
+ VERSION = "0.5.5"
737
748
 
738
749
  # Aliases for supported capabilities, to be used with the #enable command.
739
750
  ENABLE_ALIASES = {
@@ -1135,12 +1146,12 @@ module Net
1135
1146
  # )
1136
1147
  # end
1137
1148
  #
1138
- # See [ID[https://tools.ietf.org/html/rfc2971]] for field definitions.
1149
+ # See [ID[https://www.rfc-editor.org/rfc/rfc2971]] for field definitions.
1139
1150
  #
1140
1151
  # ==== Capabilities
1141
1152
  #
1142
1153
  # The server's capabilities must include +ID+
1143
- # [RFC2971[https://tools.ietf.org/html/rfc2971]].
1154
+ # [RFC2971[https://www.rfc-editor.org/rfc/rfc2971]].
1144
1155
  def id(client_id=nil)
1145
1156
  synchronize do
1146
1157
  send_command("ID", ClientID.new(client_id))
@@ -1563,7 +1574,7 @@ module Net
1563
1574
  # servers, then folder creation (and listing, moving, etc) can lead to
1564
1575
  # errors.
1565
1576
  #
1566
- # From RFC2342[https://tools.ietf.org/html/rfc2342]:
1577
+ # From RFC2342[https://www.rfc-editor.org/rfc/rfc2342]:
1567
1578
  # >>>
1568
1579
  # <em>Although typically a server will support only a single Personal
1569
1580
  # Namespace, and a single Other User's Namespace, circumstances exist
@@ -1592,8 +1603,8 @@ module Net
1592
1603
  #
1593
1604
  # ==== Capabilities
1594
1605
  #
1595
- # The server's capabilities must include +NAMESPACE+
1596
- # [RFC2342[https://tools.ietf.org/html/rfc2342]].
1606
+ # The server's capabilities must include either +IMAP4rev2+ or +NAMESPACE+
1607
+ # [RFC2342[https://www.rfc-editor.org/rfc/rfc2342]].
1597
1608
  def namespace
1598
1609
  synchronize do
1599
1610
  send_command("NAMESPACE")
@@ -1655,7 +1666,7 @@ module Net
1655
1666
  # ==== Capabilities
1656
1667
  #
1657
1668
  # The server's capabilities must include +QUOTA+
1658
- # [RFC2087[https://tools.ietf.org/html/rfc2087]].
1669
+ # [RFC2087[https://www.rfc-editor.org/rfc/rfc2087]].
1659
1670
  def getquotaroot(mailbox)
1660
1671
  synchronize do
1661
1672
  send_command("GETQUOTAROOT", mailbox)
@@ -1676,7 +1687,7 @@ module Net
1676
1687
  # ==== Capabilities
1677
1688
  #
1678
1689
  # The server's capabilities must include +QUOTA+
1679
- # [RFC2087[https://tools.ietf.org/html/rfc2087]].
1690
+ # [RFC2087[https://www.rfc-editor.org/rfc/rfc2087]].
1680
1691
  def getquota(mailbox)
1681
1692
  synchronize do
1682
1693
  send_command("GETQUOTA", mailbox)
@@ -1694,7 +1705,7 @@ module Net
1694
1705
  # ==== Capabilities
1695
1706
  #
1696
1707
  # The server's capabilities must include +QUOTA+
1697
- # [RFC2087[https://tools.ietf.org/html/rfc2087]].
1708
+ # [RFC2087[https://www.rfc-editor.org/rfc/rfc2087]].
1698
1709
  def setquota(mailbox, quota)
1699
1710
  if quota.nil?
1700
1711
  data = '()'
@@ -1714,7 +1725,7 @@ module Net
1714
1725
  # ==== Capabilities
1715
1726
  #
1716
1727
  # The server's capabilities must include +ACL+
1717
- # [RFC4314[https://tools.ietf.org/html/rfc4314]].
1728
+ # [RFC4314[https://www.rfc-editor.org/rfc/rfc4314]].
1718
1729
  def setacl(mailbox, user, rights)
1719
1730
  if rights.nil?
1720
1731
  send_command("SETACL", mailbox, user, "")
@@ -1732,7 +1743,7 @@ module Net
1732
1743
  # ==== Capabilities
1733
1744
  #
1734
1745
  # The server's capabilities must include +ACL+
1735
- # [RFC4314[https://tools.ietf.org/html/rfc4314]].
1746
+ # [RFC4314[https://www.rfc-editor.org/rfc/rfc4314]].
1736
1747
  def getacl(mailbox)
1737
1748
  synchronize do
1738
1749
  send_command("GETACL", mailbox)
@@ -1893,8 +1904,8 @@ module Net
1893
1904
  #
1894
1905
  # ==== Capabilities
1895
1906
  #
1896
- # The server's capabilities must include +UNSELECT+
1897
- # [RFC3691[https://tools.ietf.org/html/rfc3691]].
1907
+ # The server's capabilities must include either +IMAP4rev2+ or +UNSELECT+
1908
+ # [RFC3691[https://www.rfc-editor.org/rfc/rfc3691]].
1898
1909
  def unselect
1899
1910
  send_command("UNSELECT")
1900
1911
  end
@@ -1921,8 +1932,8 @@ module Net
1921
1932
  #
1922
1933
  # ==== Capabilities
1923
1934
  #
1924
- # When either QRESYNC[https://tools.ietf.org/html/rfc7162] or
1925
- # UIDONLY[https://tools.ietf.org/html/rfc9586] are enabled, #expunge
1935
+ # When either QRESYNC[https://www.rfc-editor.org/rfc/rfc7162] or
1936
+ # UIDONLY[https://www.rfc-editor.org/rfc/rfc9586] are enabled, #expunge
1926
1937
  # returns VanishedData, which contains UIDs---<em>not message sequence
1927
1938
  # numbers</em>.
1928
1939
  def expunge
@@ -2366,6 +2377,9 @@ module Net
2366
2377
  # result = imap.search(["SUBJECT", "hi there", "not", "new"])
2367
2378
  # #=> Net::IMAP::SearchResult[1, 6, 7, 8, modseq: 5594]
2368
2379
  # result.modseq # => 5594
2380
+ #
2381
+ # When UIDONLY[https://www.rfc-editor.org/rfc/rfc9586.html] is enabled,
2382
+ # the +SEARCH+ command is prohibited. Use #uid_search instead.
2369
2383
  def search(...)
2370
2384
  search_internal("SEARCH", ...)
2371
2385
  end
@@ -2383,6 +2397,16 @@ module Net
2383
2397
  # capability has been enabled.
2384
2398
  #
2385
2399
  # See #search for documentation of parameters.
2400
+ #
2401
+ # ==== Capabilities
2402
+ #
2403
+ # When UIDONLY[https://www.rfc-editor.org/rfc/rfc9586.html] is enabled,
2404
+ # #uid_search must be used instead of #search, and the <tt><message
2405
+ # set></tt> search criterion is prohibited. Use +ALL+ or <tt>UID
2406
+ # sequence-set</tt> instead.
2407
+ #
2408
+ # Otherwise, #uid_search is updated by extensions in the same way as
2409
+ # #search.
2386
2410
  def uid_search(...)
2387
2411
  search_internal("UID SEARCH", ...)
2388
2412
  end
@@ -2397,8 +2421,8 @@ module Net
2397
2421
  # to {SequenceSet[...]}[rdoc-ref:SequenceSet@Creating+sequence+sets].
2398
2422
  # (For UIDs, use #uid_fetch instead.)
2399
2423
  #
2400
- # +attr+ is a list of attributes to fetch; see the documentation
2401
- # for FetchData for a list of valid attributes.
2424
+ # +attr+ is a list of attributes to fetch; see FetchStruct documentation for
2425
+ # a list of supported attributes.
2402
2426
  #
2403
2427
  # +changedsince+ is an optional integer mod-sequence. It limits results to
2404
2428
  # messages with a mod-sequence greater than +changedsince+.
@@ -2427,19 +2451,22 @@ module Net
2427
2451
  #
2428
2452
  # ==== Capabilities
2429
2453
  #
2430
- # Many extensions define new message +attr+ names. See FetchData for a list
2431
- # of supported extension fields.
2454
+ # Many extensions define new message +attr+ names. See FetchStruct for a
2455
+ # list of supported extension fields.
2432
2456
  #
2433
2457
  # The server's capabilities must include +CONDSTORE+
2434
- # {[RFC7162]}[https://tools.ietf.org/html/rfc7162] in order to use the
2458
+ # {[RFC7162]}[https://www.rfc-editor.org/rfc/rfc7162] in order to use the
2435
2459
  # +changedsince+ argument. Using +changedsince+ implicitly enables the
2436
2460
  # +CONDSTORE+ extension.
2461
+ #
2462
+ # When UIDONLY[https://www.rfc-editor.org/rfc/rfc9586.html] is enabled, the
2463
+ # +FETCH+ command is prohibited. Use #uid_fetch instead.
2437
2464
  def fetch(...)
2438
2465
  fetch_internal("FETCH", ...)
2439
2466
  end
2440
2467
 
2441
2468
  # :call-seq:
2442
- # uid_fetch(set, attr, changedsince: nil, partial: nil) -> array of FetchData
2469
+ # uid_fetch(set, attr, changedsince: nil, partial: nil) -> array of FetchData (or UIDFetchData)
2443
2470
  #
2444
2471
  # Sends a {UID FETCH command [IMAP4rev1 §6.4.8]}[https://www.rfc-editor.org/rfc/rfc3501#section-6.4.8]
2445
2472
  # to retrieve data associated with a message in the mailbox.
@@ -2491,7 +2518,11 @@ module Net
2491
2518
  # {[RFC9394]}[https://rfc-editor.org/rfc/rfc9394] in order to use the
2492
2519
  # +partial+ argument.
2493
2520
  #
2494
- # Otherwise, the same as #fetch.
2521
+ # When UIDONLY[https://www.rfc-editor.org/rfc/rfc9586.html] is enabled,
2522
+ # #uid_fetch must be used instead of #fetch, and UIDFetchData will be
2523
+ # returned instead of FetchData.
2524
+ #
2525
+ # Otherwise, #uid_fetch is updated by extensions in the same way as #fetch.
2495
2526
  def uid_fetch(...)
2496
2527
  fetch_internal("UID FETCH", ...)
2497
2528
  end
@@ -2536,15 +2567,18 @@ module Net
2536
2567
  # Extensions may define new data items to be used with #store.
2537
2568
  #
2538
2569
  # The server's capabilities must include +CONDSTORE+
2539
- # {[RFC7162]}[https://tools.ietf.org/html/rfc7162] in order to use the
2570
+ # {[RFC7162]}[https://www.rfc-editor.org/rfc/rfc7162] in order to use the
2540
2571
  # +unchangedsince+ argument. Using +unchangedsince+ implicitly enables the
2541
2572
  # +CONDSTORE+ extension.
2573
+ #
2574
+ # When UIDONLY[https://www.rfc-editor.org/rfc/rfc9586.html] is enabled, the
2575
+ # +STORE+ command is prohibited. Use #uid_store instead.
2542
2576
  def store(set, attr, flags, unchangedsince: nil)
2543
2577
  store_internal("STORE", set, attr, flags, unchangedsince: unchangedsince)
2544
2578
  end
2545
2579
 
2546
2580
  # :call-seq:
2547
- # uid_store(set, attr, value, unchangedsince: nil) -> array of FetchData
2581
+ # uid_store(set, attr, value, unchangedsince: nil) -> array of FetchData (or UIDFetchData)
2548
2582
  #
2549
2583
  # Sends a {UID STORE command [IMAP4rev1 §6.4.8]}[https://www.rfc-editor.org/rfc/rfc3501#section-6.4.8]
2550
2584
  # to alter data associated with messages in the mailbox, in particular their
@@ -2556,7 +2590,12 @@ module Net
2556
2590
  # Related: #store
2557
2591
  #
2558
2592
  # ==== Capabilities
2559
- # Same as #store.
2593
+ #
2594
+ # When UIDONLY[https://www.rfc-editor.org/rfc/rfc9586.html] is enabled,
2595
+ # #uid_store must be used instead of #store, and UIDFetchData will be
2596
+ # returned instead of FetchData.
2597
+ #
2598
+ # Otherwise, #uid_store is updated by extensions in the same way as #store.
2560
2599
  def uid_store(set, attr, flags, unchangedsince: nil)
2561
2600
  store_internal("UID STORE", set, attr, flags, unchangedsince: unchangedsince)
2562
2601
  end
@@ -2575,6 +2614,9 @@ module Net
2575
2614
  # with UIDPlusData. This will report the UIDVALIDITY of the destination
2576
2615
  # mailbox, the UID set of the source messages, and the assigned UID set of
2577
2616
  # the moved messages.
2617
+ #
2618
+ # When UIDONLY[https://www.rfc-editor.org/rfc/rfc9586.html] is enabled, the
2619
+ # +COPY+ command is prohibited. Use #uid_copy instead.
2578
2620
  def copy(set, mailbox)
2579
2621
  copy_internal("COPY", set, mailbox)
2580
2622
  end
@@ -2587,7 +2629,10 @@ module Net
2587
2629
  #
2588
2630
  # ==== Capabilities
2589
2631
  #
2590
- # +UIDPLUS+ affects #uid_copy the same way it affects #copy.
2632
+ # When UIDONLY[https://www.rfc-editor.org/rfc/rfc9586.html] in enabled,
2633
+ # #uid_copy must be used instead of #copy.
2634
+ #
2635
+ # Otherwise, #uid_copy is updated by extensions in the same way as #copy.
2591
2636
  def uid_copy(set, mailbox)
2592
2637
  copy_internal("UID COPY", set, mailbox)
2593
2638
  end
@@ -2602,8 +2647,8 @@ module Net
2602
2647
  #
2603
2648
  # ==== Capabilities
2604
2649
  #
2605
- # The server's capabilities must include +MOVE+
2606
- # [RFC6851[https://tools.ietf.org/html/rfc6851]].
2650
+ # The server's capabilities must include either +IMAP4rev2+ or +MOVE+
2651
+ # [RFC6851[https://www.rfc-editor.org/rfc/rfc6851]].
2607
2652
  #
2608
2653
  # If +UIDPLUS+ [RFC4315[https://www.rfc-editor.org/rfc/rfc4315.html]] is
2609
2654
  # supported, the server's response should include a +COPYUID+ response code
@@ -2611,6 +2656,8 @@ module Net
2611
2656
  # mailbox, the UID set of the source messages, and the assigned UID set of
2612
2657
  # the moved messages.
2613
2658
  #
2659
+ # When UIDONLY[https://www.rfc-editor.org/rfc/rfc9586.html] is enabled, the
2660
+ # +MOVE+ command is prohibited. Use #uid_move instead.
2614
2661
  def move(set, mailbox)
2615
2662
  copy_internal("MOVE", set, mailbox)
2616
2663
  end
@@ -2626,9 +2673,13 @@ module Net
2626
2673
  #
2627
2674
  # ==== Capabilities
2628
2675
  #
2629
- # Same as #move: The server's capabilities must include +MOVE+
2630
- # [RFC6851[https://tools.ietf.org/html/rfc6851]]. +UIDPLUS+ also affects
2631
- # #uid_move the same way it affects #move.
2676
+ # The server's capabilities must include either +IMAP4rev2+ or +MOVE+
2677
+ # [RFC6851[https://www.rfc-editor.org/rfc/rfc6851]].
2678
+ #
2679
+ # When UIDONLY[https://www.rfc-editor.org/rfc/rfc9586.html] is enabled,
2680
+ # #uid_move must be used instead of #move.
2681
+ #
2682
+ # Otherwise, #uid_move is updated by extensions in the same way as #move.
2632
2683
  def uid_move(set, mailbox)
2633
2684
  copy_internal("UID MOVE", set, mailbox)
2634
2685
  end
@@ -2654,7 +2705,7 @@ module Net
2654
2705
  # ==== Capabilities
2655
2706
  #
2656
2707
  # The server's capabilities must include +SORT+
2657
- # [RFC5256[https://tools.ietf.org/html/rfc5256]].
2708
+ # [RFC5256[https://www.rfc-editor.org/rfc/rfc5256]].
2658
2709
  def sort(sort_keys, search_keys, charset)
2659
2710
  return sort_internal("SORT", sort_keys, search_keys, charset)
2660
2711
  end
@@ -2669,7 +2720,7 @@ module Net
2669
2720
  # ==== Capabilities
2670
2721
  #
2671
2722
  # The server's capabilities must include +SORT+
2672
- # [RFC5256[https://tools.ietf.org/html/rfc5256]].
2723
+ # [RFC5256[https://www.rfc-editor.org/rfc/rfc5256]].
2673
2724
  def uid_sort(sort_keys, search_keys, charset)
2674
2725
  return sort_internal("UID SORT", sort_keys, search_keys, charset)
2675
2726
  end
@@ -2694,7 +2745,7 @@ module Net
2694
2745
  # ==== Capabilities
2695
2746
  #
2696
2747
  # The server's capabilities must include +THREAD+
2697
- # [RFC5256[https://tools.ietf.org/html/rfc5256]].
2748
+ # [RFC5256[https://www.rfc-editor.org/rfc/rfc5256]].
2698
2749
  def thread(algorithm, search_keys, charset)
2699
2750
  return thread_internal("THREAD", algorithm, search_keys, charset)
2700
2751
  end
@@ -2708,7 +2759,7 @@ module Net
2708
2759
  # ==== Capabilities
2709
2760
  #
2710
2761
  # The server's capabilities must include +THREAD+
2711
- # [RFC5256[https://tools.ietf.org/html/rfc5256]].
2762
+ # [RFC5256[https://www.rfc-editor.org/rfc/rfc5256]].
2712
2763
  def uid_thread(algorithm, search_keys, charset)
2713
2764
  return thread_internal("UID THREAD", algorithm, search_keys, charset)
2714
2765
  end
@@ -2727,8 +2778,8 @@ module Net
2727
2778
  # ==== Capabilities
2728
2779
  #
2729
2780
  # The server's capabilities must include
2730
- # +ENABLE+ [RFC5161[https://tools.ietf.org/html/rfc5161]]
2731
- # or +IMAP4REV2+ [RFC9051[https://tools.ietf.org/html/rfc9051]].
2781
+ # +ENABLE+ [RFC5161[https://www.rfc-editor.org/rfc/rfc5161]]
2782
+ # or +IMAP4REV2+ [RFC9051[https://www.rfc-editor.org/rfc/rfc9051]].
2732
2783
  #
2733
2784
  # Additionally, the server capabilities must include a capability matching
2734
2785
  # each enabled extension (usually the same name as the enabled extension).
@@ -2747,7 +2798,7 @@ module Net
2747
2798
  # <tt>"UTF8=ACCEPT"</tt> or <tt>"IMAP4rev2"</tt>, depending on server
2748
2799
  # capabilities.
2749
2800
  #
2750
- # [<tt>"UTF8=ACCEPT"</tt> [RFC6855[https://tools.ietf.org/html/rfc6855]]]
2801
+ # [<tt>"UTF8=ACCEPT"</tt> [RFC6855[https://www.rfc-editor.org/rfc/rfc6855]]]
2751
2802
  #
2752
2803
  # The server's capabilities must include <tt>UTF8=ACCEPT</tt> _or_
2753
2804
  # <tt>UTF8=ONLY</tt>.
@@ -2766,13 +2817,23 @@ module Net
2766
2817
  # encoding, even if they generally contain UTF-8 data, if they are
2767
2818
  # text at all.
2768
2819
  #
2769
- # [<tt>"UTF8=ONLY"</tt> [RFC6855[https://tools.ietf.org/html/rfc6855]]]
2820
+ # [<tt>"UTF8=ONLY"</tt> [RFC6855[https://www.rfc-editor.org/rfc/rfc6855]]]
2770
2821
  #
2771
2822
  # A server that reports the <tt>UTF8=ONLY</tt> capability _requires_ that
2772
2823
  # the client <tt>enable("UTF8=ACCEPT")</tt> before any mailboxes may be
2773
2824
  # selected. For convenience, <tt>enable("UTF8=ONLY")</tt> is aliased to
2774
2825
  # <tt>enable("UTF8=ACCEPT")</tt>.
2775
2826
  #
2827
+ # [+UIDONLY+ {[RFC9586]}[https://www.rfc-editor.org/rfc/rfc9586.pdf]]
2828
+ #
2829
+ # When UIDONLY is enabled, the #fetch, #store, #search, #copy, and #move
2830
+ # commands are prohibited and result in a tagged BAD response. Clients
2831
+ # should instead use uid_fetch, uid_store, uid_search, uid_copy, or
2832
+ # uid_move, respectively. All +FETCH+ responses that would be returned are
2833
+ # replaced by +UIDFETCH+ responses. All +EXPUNGED+ responses that would be
2834
+ # returned are replaced by +VANISHED+ responses. The "<sequence set>"
2835
+ # uid_search criterion is prohibited.
2836
+ #
2776
2837
  # ===== Unsupported capabilities
2777
2838
  #
2778
2839
  # *Note:* Some extensions that use ENABLE permit the server to send syntax
@@ -2828,8 +2889,8 @@ module Net
2828
2889
  #
2829
2890
  # ==== Capabilities
2830
2891
  #
2831
- # The server's capabilities must include +IDLE+
2832
- # [RFC2177[https://tools.ietf.org/html/rfc2177]].
2892
+ # The server's capabilities must include either +IMAP4rev2+ or +IDLE+
2893
+ # [RFC2177[https://www.rfc-editor.org/rfc/rfc2177]].
2833
2894
  def idle(timeout = nil, &response_handler)
2834
2895
  raise LocalJumpError, "no block given" unless response_handler
2835
2896
 
@@ -3458,15 +3519,9 @@ module Net
3458
3519
  }
3459
3520
  end
3460
3521
 
3461
- synchronize do
3462
- clear_responses("FETCH")
3463
- if mod
3464
- send_command(cmd, set, attr, mod)
3465
- else
3466
- send_command(cmd, set, attr)
3467
- end
3468
- clear_responses("FETCH")
3469
- end
3522
+ args = [cmd, set, attr]
3523
+ args << mod if mod
3524
+ send_command_returning_fetch_results(*args)
3470
3525
  end
3471
3526
 
3472
3527
  def store_internal(cmd, set, attr, flags, unchangedsince: nil)
@@ -3474,10 +3529,17 @@ module Net
3474
3529
  args = [SequenceSet.new(set)]
3475
3530
  args << ["UNCHANGEDSINCE", Integer(unchangedsince)] if unchangedsince
3476
3531
  args << attr << flags
3532
+ send_command_returning_fetch_results(cmd, *args)
3533
+ end
3534
+
3535
+ def send_command_returning_fetch_results(...)
3477
3536
  synchronize do
3478
3537
  clear_responses("FETCH")
3479
- send_command(cmd, *args)
3480
- clear_responses("FETCH")
3538
+ clear_responses("UIDFETCH")
3539
+ send_command(...)
3540
+ fetches = clear_responses("FETCH")
3541
+ uidfetches = clear_responses("UIDFETCH")
3542
+ uidfetches.any? ? uidfetches : fetches
3481
3543
  end
3482
3544
  end
3483
3545