net-imap 0.5.4 → 0.5.6
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/Gemfile +1 -0
- data/README.md +3 -1
- data/docs/styles.css +11 -1
- data/lib/net/imap/config.rb +73 -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 +116 -144
- data/lib/net/imap/response_parser.rb +41 -15
- 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/sequence_set.rb +193 -58
- 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 +244 -0
- data/lib/net/imap.rb +171 -101
- data/rakelib/rfcs.rake +1 -0
- metadata +4 -6
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://
|
29
|
-
# and {IMAP4rev2 [RFC9051]}[https://
|
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://
|
302
|
+
# the [IMAP4rev1[https://www.rfc-editor.org/rfc/rfc3501]] base specification, or
|
303
303
|
# by one of the following extensions:
|
304
|
-
# [IDLE[https://
|
305
|
-
# [NAMESPACE[https://
|
306
|
-
# [UNSELECT[https://
|
307
|
-
# [ENABLE[https://
|
308
|
-
# [MOVE[https://
|
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://
|
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://
|
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://
|
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://
|
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://
|
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://
|
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://
|
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://
|
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://
|
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://
|
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://
|
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://
|
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://
|
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://
|
586
|
-
# RFC-822[https://
|
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://
|
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://
|
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://
|
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://
|
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://
|
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://
|
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://
|
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://
|
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://
|
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://
|
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://
|
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://
|
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://
|
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://
|
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://
|
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://
|
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://
|
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://
|
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://
|
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://
|
695
|
-
# [UTF8=ONLY[https://
|
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://
|
700
|
-
# [QRESYNC[https://
|
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://
|
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
|
-
#
|
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.
|
747
|
+
VERSION = "0.5.6"
|
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://
|
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://
|
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))
|
@@ -1228,13 +1239,21 @@ module Net
|
|
1228
1239
|
#
|
1229
1240
|
def starttls(**options)
|
1230
1241
|
@ssl_ctx_params, @ssl_ctx = build_ssl_ctx(options)
|
1231
|
-
|
1242
|
+
error = nil
|
1243
|
+
ok = send_command("STARTTLS") do |resp|
|
1232
1244
|
if resp.kind_of?(TaggedResponse) && resp.name == "OK"
|
1233
1245
|
clear_cached_capabilities
|
1234
1246
|
clear_responses
|
1235
1247
|
start_tls_session
|
1236
1248
|
end
|
1249
|
+
rescue Exception => error
|
1250
|
+
raise # note that the error backtrace is in the receiver_thread
|
1251
|
+
end
|
1252
|
+
if error
|
1253
|
+
disconnect
|
1254
|
+
raise error
|
1237
1255
|
end
|
1256
|
+
ok
|
1238
1257
|
end
|
1239
1258
|
|
1240
1259
|
# :call-seq:
|
@@ -1563,7 +1582,7 @@ module Net
|
|
1563
1582
|
# servers, then folder creation (and listing, moving, etc) can lead to
|
1564
1583
|
# errors.
|
1565
1584
|
#
|
1566
|
-
# From RFC2342[https://
|
1585
|
+
# From RFC2342[https://www.rfc-editor.org/rfc/rfc2342]:
|
1567
1586
|
# >>>
|
1568
1587
|
# <em>Although typically a server will support only a single Personal
|
1569
1588
|
# Namespace, and a single Other User's Namespace, circumstances exist
|
@@ -1592,8 +1611,8 @@ module Net
|
|
1592
1611
|
#
|
1593
1612
|
# ==== Capabilities
|
1594
1613
|
#
|
1595
|
-
# The server's capabilities must include +NAMESPACE+
|
1596
|
-
# [RFC2342[https://
|
1614
|
+
# The server's capabilities must include either +IMAP4rev2+ or +NAMESPACE+
|
1615
|
+
# [RFC2342[https://www.rfc-editor.org/rfc/rfc2342]].
|
1597
1616
|
def namespace
|
1598
1617
|
synchronize do
|
1599
1618
|
send_command("NAMESPACE")
|
@@ -1655,7 +1674,7 @@ module Net
|
|
1655
1674
|
# ==== Capabilities
|
1656
1675
|
#
|
1657
1676
|
# The server's capabilities must include +QUOTA+
|
1658
|
-
# [RFC2087[https://
|
1677
|
+
# [RFC2087[https://www.rfc-editor.org/rfc/rfc2087]].
|
1659
1678
|
def getquotaroot(mailbox)
|
1660
1679
|
synchronize do
|
1661
1680
|
send_command("GETQUOTAROOT", mailbox)
|
@@ -1676,7 +1695,7 @@ module Net
|
|
1676
1695
|
# ==== Capabilities
|
1677
1696
|
#
|
1678
1697
|
# The server's capabilities must include +QUOTA+
|
1679
|
-
# [RFC2087[https://
|
1698
|
+
# [RFC2087[https://www.rfc-editor.org/rfc/rfc2087]].
|
1680
1699
|
def getquota(mailbox)
|
1681
1700
|
synchronize do
|
1682
1701
|
send_command("GETQUOTA", mailbox)
|
@@ -1694,7 +1713,7 @@ module Net
|
|
1694
1713
|
# ==== Capabilities
|
1695
1714
|
#
|
1696
1715
|
# The server's capabilities must include +QUOTA+
|
1697
|
-
# [RFC2087[https://
|
1716
|
+
# [RFC2087[https://www.rfc-editor.org/rfc/rfc2087]].
|
1698
1717
|
def setquota(mailbox, quota)
|
1699
1718
|
if quota.nil?
|
1700
1719
|
data = '()'
|
@@ -1714,7 +1733,7 @@ module Net
|
|
1714
1733
|
# ==== Capabilities
|
1715
1734
|
#
|
1716
1735
|
# The server's capabilities must include +ACL+
|
1717
|
-
# [RFC4314[https://
|
1736
|
+
# [RFC4314[https://www.rfc-editor.org/rfc/rfc4314]].
|
1718
1737
|
def setacl(mailbox, user, rights)
|
1719
1738
|
if rights.nil?
|
1720
1739
|
send_command("SETACL", mailbox, user, "")
|
@@ -1732,7 +1751,7 @@ module Net
|
|
1732
1751
|
# ==== Capabilities
|
1733
1752
|
#
|
1734
1753
|
# The server's capabilities must include +ACL+
|
1735
|
-
# [RFC4314[https://
|
1754
|
+
# [RFC4314[https://www.rfc-editor.org/rfc/rfc4314]].
|
1736
1755
|
def getacl(mailbox)
|
1737
1756
|
synchronize do
|
1738
1757
|
send_command("GETACL", mailbox)
|
@@ -1893,8 +1912,8 @@ module Net
|
|
1893
1912
|
#
|
1894
1913
|
# ==== Capabilities
|
1895
1914
|
#
|
1896
|
-
# The server's capabilities must include +UNSELECT+
|
1897
|
-
# [RFC3691[https://
|
1915
|
+
# The server's capabilities must include either +IMAP4rev2+ or +UNSELECT+
|
1916
|
+
# [RFC3691[https://www.rfc-editor.org/rfc/rfc3691]].
|
1898
1917
|
def unselect
|
1899
1918
|
send_command("UNSELECT")
|
1900
1919
|
end
|
@@ -1921,8 +1940,8 @@ module Net
|
|
1921
1940
|
#
|
1922
1941
|
# ==== Capabilities
|
1923
1942
|
#
|
1924
|
-
# When either QRESYNC[https://
|
1925
|
-
# UIDONLY[https://
|
1943
|
+
# When either QRESYNC[https://www.rfc-editor.org/rfc/rfc7162] or
|
1944
|
+
# UIDONLY[https://www.rfc-editor.org/rfc/rfc9586] are enabled, #expunge
|
1926
1945
|
# returns VanishedData, which contains UIDs---<em>not message sequence
|
1927
1946
|
# numbers</em>.
|
1928
1947
|
def expunge
|
@@ -2366,6 +2385,9 @@ module Net
|
|
2366
2385
|
# result = imap.search(["SUBJECT", "hi there", "not", "new"])
|
2367
2386
|
# #=> Net::IMAP::SearchResult[1, 6, 7, 8, modseq: 5594]
|
2368
2387
|
# result.modseq # => 5594
|
2388
|
+
#
|
2389
|
+
# When UIDONLY[https://www.rfc-editor.org/rfc/rfc9586.html] is enabled,
|
2390
|
+
# the +SEARCH+ command is prohibited. Use #uid_search instead.
|
2369
2391
|
def search(...)
|
2370
2392
|
search_internal("SEARCH", ...)
|
2371
2393
|
end
|
@@ -2383,6 +2405,16 @@ module Net
|
|
2383
2405
|
# capability has been enabled.
|
2384
2406
|
#
|
2385
2407
|
# See #search for documentation of parameters.
|
2408
|
+
#
|
2409
|
+
# ==== Capabilities
|
2410
|
+
#
|
2411
|
+
# When UIDONLY[https://www.rfc-editor.org/rfc/rfc9586.html] is enabled,
|
2412
|
+
# #uid_search must be used instead of #search, and the <tt><message
|
2413
|
+
# set></tt> search criterion is prohibited. Use +ALL+ or <tt>UID
|
2414
|
+
# sequence-set</tt> instead.
|
2415
|
+
#
|
2416
|
+
# Otherwise, #uid_search is updated by extensions in the same way as
|
2417
|
+
# #search.
|
2386
2418
|
def uid_search(...)
|
2387
2419
|
search_internal("UID SEARCH", ...)
|
2388
2420
|
end
|
@@ -2397,8 +2429,8 @@ module Net
|
|
2397
2429
|
# to {SequenceSet[...]}[rdoc-ref:SequenceSet@Creating+sequence+sets].
|
2398
2430
|
# (For UIDs, use #uid_fetch instead.)
|
2399
2431
|
#
|
2400
|
-
# +attr+ is a list of attributes to fetch; see
|
2401
|
-
#
|
2432
|
+
# +attr+ is a list of attributes to fetch; see FetchStruct documentation for
|
2433
|
+
# a list of supported attributes.
|
2402
2434
|
#
|
2403
2435
|
# +changedsince+ is an optional integer mod-sequence. It limits results to
|
2404
2436
|
# messages with a mod-sequence greater than +changedsince+.
|
@@ -2427,19 +2459,22 @@ module Net
|
|
2427
2459
|
#
|
2428
2460
|
# ==== Capabilities
|
2429
2461
|
#
|
2430
|
-
# Many extensions define new message +attr+ names. See
|
2431
|
-
# of supported extension fields.
|
2462
|
+
# Many extensions define new message +attr+ names. See FetchStruct for a
|
2463
|
+
# list of supported extension fields.
|
2432
2464
|
#
|
2433
2465
|
# The server's capabilities must include +CONDSTORE+
|
2434
|
-
# {[RFC7162]}[https://
|
2466
|
+
# {[RFC7162]}[https://www.rfc-editor.org/rfc/rfc7162] in order to use the
|
2435
2467
|
# +changedsince+ argument. Using +changedsince+ implicitly enables the
|
2436
2468
|
# +CONDSTORE+ extension.
|
2469
|
+
#
|
2470
|
+
# When UIDONLY[https://www.rfc-editor.org/rfc/rfc9586.html] is enabled, the
|
2471
|
+
# +FETCH+ command is prohibited. Use #uid_fetch instead.
|
2437
2472
|
def fetch(...)
|
2438
2473
|
fetch_internal("FETCH", ...)
|
2439
2474
|
end
|
2440
2475
|
|
2441
2476
|
# :call-seq:
|
2442
|
-
# uid_fetch(set, attr, changedsince: nil, partial: nil) -> array of FetchData
|
2477
|
+
# uid_fetch(set, attr, changedsince: nil, partial: nil) -> array of FetchData (or UIDFetchData)
|
2443
2478
|
#
|
2444
2479
|
# Sends a {UID FETCH command [IMAP4rev1 §6.4.8]}[https://www.rfc-editor.org/rfc/rfc3501#section-6.4.8]
|
2445
2480
|
# to retrieve data associated with a message in the mailbox.
|
@@ -2491,7 +2526,11 @@ module Net
|
|
2491
2526
|
# {[RFC9394]}[https://rfc-editor.org/rfc/rfc9394] in order to use the
|
2492
2527
|
# +partial+ argument.
|
2493
2528
|
#
|
2494
|
-
#
|
2529
|
+
# When UIDONLY[https://www.rfc-editor.org/rfc/rfc9586.html] is enabled,
|
2530
|
+
# #uid_fetch must be used instead of #fetch, and UIDFetchData will be
|
2531
|
+
# returned instead of FetchData.
|
2532
|
+
#
|
2533
|
+
# Otherwise, #uid_fetch is updated by extensions in the same way as #fetch.
|
2495
2534
|
def uid_fetch(...)
|
2496
2535
|
fetch_internal("UID FETCH", ...)
|
2497
2536
|
end
|
@@ -2536,15 +2575,18 @@ module Net
|
|
2536
2575
|
# Extensions may define new data items to be used with #store.
|
2537
2576
|
#
|
2538
2577
|
# The server's capabilities must include +CONDSTORE+
|
2539
|
-
# {[RFC7162]}[https://
|
2578
|
+
# {[RFC7162]}[https://www.rfc-editor.org/rfc/rfc7162] in order to use the
|
2540
2579
|
# +unchangedsince+ argument. Using +unchangedsince+ implicitly enables the
|
2541
2580
|
# +CONDSTORE+ extension.
|
2581
|
+
#
|
2582
|
+
# When UIDONLY[https://www.rfc-editor.org/rfc/rfc9586.html] is enabled, the
|
2583
|
+
# +STORE+ command is prohibited. Use #uid_store instead.
|
2542
2584
|
def store(set, attr, flags, unchangedsince: nil)
|
2543
2585
|
store_internal("STORE", set, attr, flags, unchangedsince: unchangedsince)
|
2544
2586
|
end
|
2545
2587
|
|
2546
2588
|
# :call-seq:
|
2547
|
-
# uid_store(set, attr, value, unchangedsince: nil) -> array of FetchData
|
2589
|
+
# uid_store(set, attr, value, unchangedsince: nil) -> array of FetchData (or UIDFetchData)
|
2548
2590
|
#
|
2549
2591
|
# Sends a {UID STORE command [IMAP4rev1 §6.4.8]}[https://www.rfc-editor.org/rfc/rfc3501#section-6.4.8]
|
2550
2592
|
# to alter data associated with messages in the mailbox, in particular their
|
@@ -2556,7 +2598,12 @@ module Net
|
|
2556
2598
|
# Related: #store
|
2557
2599
|
#
|
2558
2600
|
# ==== Capabilities
|
2559
|
-
#
|
2601
|
+
#
|
2602
|
+
# When UIDONLY[https://www.rfc-editor.org/rfc/rfc9586.html] is enabled,
|
2603
|
+
# #uid_store must be used instead of #store, and UIDFetchData will be
|
2604
|
+
# returned instead of FetchData.
|
2605
|
+
#
|
2606
|
+
# Otherwise, #uid_store is updated by extensions in the same way as #store.
|
2560
2607
|
def uid_store(set, attr, flags, unchangedsince: nil)
|
2561
2608
|
store_internal("UID STORE", set, attr, flags, unchangedsince: unchangedsince)
|
2562
2609
|
end
|
@@ -2575,6 +2622,9 @@ module Net
|
|
2575
2622
|
# with UIDPlusData. This will report the UIDVALIDITY of the destination
|
2576
2623
|
# mailbox, the UID set of the source messages, and the assigned UID set of
|
2577
2624
|
# the moved messages.
|
2625
|
+
#
|
2626
|
+
# When UIDONLY[https://www.rfc-editor.org/rfc/rfc9586.html] is enabled, the
|
2627
|
+
# +COPY+ command is prohibited. Use #uid_copy instead.
|
2578
2628
|
def copy(set, mailbox)
|
2579
2629
|
copy_internal("COPY", set, mailbox)
|
2580
2630
|
end
|
@@ -2587,7 +2637,10 @@ module Net
|
|
2587
2637
|
#
|
2588
2638
|
# ==== Capabilities
|
2589
2639
|
#
|
2590
|
-
#
|
2640
|
+
# When UIDONLY[https://www.rfc-editor.org/rfc/rfc9586.html] in enabled,
|
2641
|
+
# #uid_copy must be used instead of #copy.
|
2642
|
+
#
|
2643
|
+
# Otherwise, #uid_copy is updated by extensions in the same way as #copy.
|
2591
2644
|
def uid_copy(set, mailbox)
|
2592
2645
|
copy_internal("UID COPY", set, mailbox)
|
2593
2646
|
end
|
@@ -2602,8 +2655,8 @@ module Net
|
|
2602
2655
|
#
|
2603
2656
|
# ==== Capabilities
|
2604
2657
|
#
|
2605
|
-
# The server's capabilities must include +MOVE+
|
2606
|
-
# [RFC6851[https://
|
2658
|
+
# The server's capabilities must include either +IMAP4rev2+ or +MOVE+
|
2659
|
+
# [RFC6851[https://www.rfc-editor.org/rfc/rfc6851]].
|
2607
2660
|
#
|
2608
2661
|
# If +UIDPLUS+ [RFC4315[https://www.rfc-editor.org/rfc/rfc4315.html]] is
|
2609
2662
|
# supported, the server's response should include a +COPYUID+ response code
|
@@ -2611,6 +2664,8 @@ module Net
|
|
2611
2664
|
# mailbox, the UID set of the source messages, and the assigned UID set of
|
2612
2665
|
# the moved messages.
|
2613
2666
|
#
|
2667
|
+
# When UIDONLY[https://www.rfc-editor.org/rfc/rfc9586.html] is enabled, the
|
2668
|
+
# +MOVE+ command is prohibited. Use #uid_move instead.
|
2614
2669
|
def move(set, mailbox)
|
2615
2670
|
copy_internal("MOVE", set, mailbox)
|
2616
2671
|
end
|
@@ -2626,9 +2681,13 @@ module Net
|
|
2626
2681
|
#
|
2627
2682
|
# ==== Capabilities
|
2628
2683
|
#
|
2629
|
-
#
|
2630
|
-
# [RFC6851[https://
|
2631
|
-
#
|
2684
|
+
# The server's capabilities must include either +IMAP4rev2+ or +MOVE+
|
2685
|
+
# [RFC6851[https://www.rfc-editor.org/rfc/rfc6851]].
|
2686
|
+
#
|
2687
|
+
# When UIDONLY[https://www.rfc-editor.org/rfc/rfc9586.html] is enabled,
|
2688
|
+
# #uid_move must be used instead of #move.
|
2689
|
+
#
|
2690
|
+
# Otherwise, #uid_move is updated by extensions in the same way as #move.
|
2632
2691
|
def uid_move(set, mailbox)
|
2633
2692
|
copy_internal("UID MOVE", set, mailbox)
|
2634
2693
|
end
|
@@ -2654,7 +2713,7 @@ module Net
|
|
2654
2713
|
# ==== Capabilities
|
2655
2714
|
#
|
2656
2715
|
# The server's capabilities must include +SORT+
|
2657
|
-
# [RFC5256[https://
|
2716
|
+
# [RFC5256[https://www.rfc-editor.org/rfc/rfc5256]].
|
2658
2717
|
def sort(sort_keys, search_keys, charset)
|
2659
2718
|
return sort_internal("SORT", sort_keys, search_keys, charset)
|
2660
2719
|
end
|
@@ -2669,7 +2728,7 @@ module Net
|
|
2669
2728
|
# ==== Capabilities
|
2670
2729
|
#
|
2671
2730
|
# The server's capabilities must include +SORT+
|
2672
|
-
# [RFC5256[https://
|
2731
|
+
# [RFC5256[https://www.rfc-editor.org/rfc/rfc5256]].
|
2673
2732
|
def uid_sort(sort_keys, search_keys, charset)
|
2674
2733
|
return sort_internal("UID SORT", sort_keys, search_keys, charset)
|
2675
2734
|
end
|
@@ -2694,7 +2753,7 @@ module Net
|
|
2694
2753
|
# ==== Capabilities
|
2695
2754
|
#
|
2696
2755
|
# The server's capabilities must include +THREAD+
|
2697
|
-
# [RFC5256[https://
|
2756
|
+
# [RFC5256[https://www.rfc-editor.org/rfc/rfc5256]].
|
2698
2757
|
def thread(algorithm, search_keys, charset)
|
2699
2758
|
return thread_internal("THREAD", algorithm, search_keys, charset)
|
2700
2759
|
end
|
@@ -2708,7 +2767,7 @@ module Net
|
|
2708
2767
|
# ==== Capabilities
|
2709
2768
|
#
|
2710
2769
|
# The server's capabilities must include +THREAD+
|
2711
|
-
# [RFC5256[https://
|
2770
|
+
# [RFC5256[https://www.rfc-editor.org/rfc/rfc5256]].
|
2712
2771
|
def uid_thread(algorithm, search_keys, charset)
|
2713
2772
|
return thread_internal("UID THREAD", algorithm, search_keys, charset)
|
2714
2773
|
end
|
@@ -2727,8 +2786,8 @@ module Net
|
|
2727
2786
|
# ==== Capabilities
|
2728
2787
|
#
|
2729
2788
|
# The server's capabilities must include
|
2730
|
-
# +ENABLE+ [RFC5161[https://
|
2731
|
-
# or +IMAP4REV2+ [RFC9051[https://
|
2789
|
+
# +ENABLE+ [RFC5161[https://www.rfc-editor.org/rfc/rfc5161]]
|
2790
|
+
# or +IMAP4REV2+ [RFC9051[https://www.rfc-editor.org/rfc/rfc9051]].
|
2732
2791
|
#
|
2733
2792
|
# Additionally, the server capabilities must include a capability matching
|
2734
2793
|
# each enabled extension (usually the same name as the enabled extension).
|
@@ -2747,7 +2806,7 @@ module Net
|
|
2747
2806
|
# <tt>"UTF8=ACCEPT"</tt> or <tt>"IMAP4rev2"</tt>, depending on server
|
2748
2807
|
# capabilities.
|
2749
2808
|
#
|
2750
|
-
# [<tt>"UTF8=ACCEPT"</tt> [RFC6855[https://
|
2809
|
+
# [<tt>"UTF8=ACCEPT"</tt> [RFC6855[https://www.rfc-editor.org/rfc/rfc6855]]]
|
2751
2810
|
#
|
2752
2811
|
# The server's capabilities must include <tt>UTF8=ACCEPT</tt> _or_
|
2753
2812
|
# <tt>UTF8=ONLY</tt>.
|
@@ -2766,13 +2825,23 @@ module Net
|
|
2766
2825
|
# encoding, even if they generally contain UTF-8 data, if they are
|
2767
2826
|
# text at all.
|
2768
2827
|
#
|
2769
|
-
# [<tt>"UTF8=ONLY"</tt> [RFC6855[https://
|
2828
|
+
# [<tt>"UTF8=ONLY"</tt> [RFC6855[https://www.rfc-editor.org/rfc/rfc6855]]]
|
2770
2829
|
#
|
2771
2830
|
# A server that reports the <tt>UTF8=ONLY</tt> capability _requires_ that
|
2772
2831
|
# the client <tt>enable("UTF8=ACCEPT")</tt> before any mailboxes may be
|
2773
2832
|
# selected. For convenience, <tt>enable("UTF8=ONLY")</tt> is aliased to
|
2774
2833
|
# <tt>enable("UTF8=ACCEPT")</tt>.
|
2775
2834
|
#
|
2835
|
+
# [+UIDONLY+ {[RFC9586]}[https://www.rfc-editor.org/rfc/rfc9586.pdf]]
|
2836
|
+
#
|
2837
|
+
# When UIDONLY is enabled, the #fetch, #store, #search, #copy, and #move
|
2838
|
+
# commands are prohibited and result in a tagged BAD response. Clients
|
2839
|
+
# should instead use uid_fetch, uid_store, uid_search, uid_copy, or
|
2840
|
+
# uid_move, respectively. All +FETCH+ responses that would be returned are
|
2841
|
+
# replaced by +UIDFETCH+ responses. All +EXPUNGED+ responses that would be
|
2842
|
+
# returned are replaced by +VANISHED+ responses. The "<sequence set>"
|
2843
|
+
# uid_search criterion is prohibited.
|
2844
|
+
#
|
2776
2845
|
# ===== Unsupported capabilities
|
2777
2846
|
#
|
2778
2847
|
# *Note:* Some extensions that use ENABLE permit the server to send syntax
|
@@ -2828,8 +2897,8 @@ module Net
|
|
2828
2897
|
#
|
2829
2898
|
# ==== Capabilities
|
2830
2899
|
#
|
2831
|
-
# The server's capabilities must include +IDLE+
|
2832
|
-
# [RFC2177[https://
|
2900
|
+
# The server's capabilities must include either +IMAP4rev2+ or +IDLE+
|
2901
|
+
# [RFC2177[https://www.rfc-editor.org/rfc/rfc2177]].
|
2833
2902
|
def idle(timeout = nil, &response_handler)
|
2834
2903
|
raise LocalJumpError, "no block given" unless response_handler
|
2835
2904
|
|
@@ -3458,15 +3527,9 @@ module Net
|
|
3458
3527
|
}
|
3459
3528
|
end
|
3460
3529
|
|
3461
|
-
|
3462
|
-
|
3463
|
-
|
3464
|
-
send_command(cmd, set, attr, mod)
|
3465
|
-
else
|
3466
|
-
send_command(cmd, set, attr)
|
3467
|
-
end
|
3468
|
-
clear_responses("FETCH")
|
3469
|
-
end
|
3530
|
+
args = [cmd, set, attr]
|
3531
|
+
args << mod if mod
|
3532
|
+
send_command_returning_fetch_results(*args)
|
3470
3533
|
end
|
3471
3534
|
|
3472
3535
|
def store_internal(cmd, set, attr, flags, unchangedsince: nil)
|
@@ -3474,10 +3537,17 @@ module Net
|
|
3474
3537
|
args = [SequenceSet.new(set)]
|
3475
3538
|
args << ["UNCHANGEDSINCE", Integer(unchangedsince)] if unchangedsince
|
3476
3539
|
args << attr << flags
|
3540
|
+
send_command_returning_fetch_results(cmd, *args)
|
3541
|
+
end
|
3542
|
+
|
3543
|
+
def send_command_returning_fetch_results(...)
|
3477
3544
|
synchronize do
|
3478
3545
|
clear_responses("FETCH")
|
3479
|
-
|
3480
|
-
|
3546
|
+
clear_responses("UIDFETCH")
|
3547
|
+
send_command(...)
|
3548
|
+
fetches = clear_responses("FETCH")
|
3549
|
+
uidfetches = clear_responses("UIDFETCH")
|
3550
|
+
uidfetches.any? ? uidfetches : fetches
|
3481
3551
|
end
|
3482
3552
|
end
|
3483
3553
|
|