net-imap 0.5.1 → 0.5.2

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.

@@ -769,7 +769,6 @@ module Net
769
769
  def response_data__ignored; response_data__unhandled(IgnoredResponse) end
770
770
  alias response_data__noop response_data__ignored
771
771
 
772
- alias esearch_response response_data__unhandled
773
772
  alias expunged_resp response_data__unhandled
774
773
  alias uidfetch_resp response_data__unhandled
775
774
  alias listrights_data response_data__unhandled
@@ -1468,6 +1467,78 @@ module Net
1468
1467
  end
1469
1468
  alias sort_data mailbox_data__search
1470
1469
 
1470
+ # esearch-response = "ESEARCH" [search-correlator] [SP "UID"]
1471
+ # *(SP search-return-data)
1472
+ # ;; Note that SEARCH and ESEARCH responses
1473
+ # ;; SHOULD be mutually exclusive,
1474
+ # ;; i.e., only one of the response types
1475
+ # ;; should be
1476
+ # ;; returned as a result of a command.
1477
+ # esearch-response = "ESEARCH" [search-correlator] [SP "UID"]
1478
+ # *(SP search-return-data)
1479
+ # ; ESEARCH response replaces SEARCH response
1480
+ # ; from IMAP4rev1.
1481
+ # search-correlator = SP "(" "TAG" SP tag-string ")"
1482
+ def esearch_response
1483
+ name = label("ESEARCH")
1484
+ tag = search_correlator if peek_str?(" (")
1485
+ uid = peek_re?(/\G UID\b/i) && (SP!; label("UID"); true)
1486
+ data = []
1487
+ data << search_return_data while SP?
1488
+ esearch = ESearchResult.new(tag, uid, data)
1489
+ UntaggedResponse.new(name, esearch, @str)
1490
+ end
1491
+
1492
+ # From RFC4731 (ESEARCH):
1493
+ # search-return-data = "MIN" SP nz-number /
1494
+ # "MAX" SP nz-number /
1495
+ # "ALL" SP sequence-set /
1496
+ # "COUNT" SP number /
1497
+ # search-ret-data-ext
1498
+ # ; All return data items conform to
1499
+ # ; search-ret-data-ext syntax.
1500
+ # search-ret-data-ext = search-modifier-name SP search-return-value
1501
+ # search-modifier-name = tagged-ext-label
1502
+ # search-return-value = tagged-ext-val
1503
+ #
1504
+ # From RFC4731 (ESEARCH):
1505
+ # search-return-data =/ "MODSEQ" SP mod-sequence-value
1506
+ #
1507
+ def search_return_data
1508
+ label = search_modifier_name; SP!
1509
+ value =
1510
+ case label
1511
+ when "MIN" then nz_number
1512
+ when "MAX" then nz_number
1513
+ when "ALL" then sequence_set
1514
+ when "COUNT" then number
1515
+ when "MODSEQ" then mod_sequence_value # RFC7162: CONDSTORE
1516
+ else search_return_value
1517
+ end
1518
+ [label, value]
1519
+ end
1520
+
1521
+ # search-modifier-name = tagged-ext-label
1522
+ alias search_modifier_name tagged_ext_label
1523
+
1524
+ # search-return-value = tagged-ext-val
1525
+ # ; Data for the returned search option.
1526
+ # ; A single "nz-number"/"number"/"number64" value
1527
+ # ; can be returned as an atom (i.e., without
1528
+ # ; quoting). A sequence-set can be returned
1529
+ # ; as an atom as well.
1530
+ def search_return_value; ExtensionData.new(tagged_ext_val) end
1531
+
1532
+ # search-correlator = SP "(" "TAG" SP tag-string ")"
1533
+ def search_correlator
1534
+ SP!; lpar; label("TAG"); SP!; tag = tag_string; rpar
1535
+ tag
1536
+ end
1537
+
1538
+ # tag-string = astring
1539
+ # ; <tag> represented as <astring>
1540
+ alias tag_string astring
1541
+
1471
1542
  # RFC5256: THREAD
1472
1543
  # thread-data = "THREAD" [SP 1*thread-list]
1473
1544
  def thread_data