@@ -273,10 +273,16 @@ An :class:`IMAP4` instance has the following methods:
273273 mailbox. This is the recommended command before ``LOGOUT ``.
274274
275275
276- .. method :: IMAP4.copy(message_set, new_mailbox)
276+ .. method :: IMAP4.copy(message_set, new_mailbox, *, uid=False )
277277
278278 Copy *message_set * messages onto end of *new_mailbox *.
279279
280+ If *uid * is true, *message_set * is a set of UIDs and the ``UID COPY ``
281+ command is used instead of ``COPY ``.
282+
283+ .. versionchanged :: next
284+ Added the *uid * parameter.
285+
280286
281287.. method :: IMAP4.create(mailbox)
282288
@@ -303,19 +309,33 @@ An :class:`IMAP4` instance has the following methods:
303309 The :meth: `enable ` method itself, and :RFC: `6855 ` support.
304310
305311
306- .. method :: IMAP4.expunge()
312+ .. method :: IMAP4.expunge(message_set=None, *, uid=False )
307313
308314 Permanently remove deleted items from selected mailbox. Generates an ``EXPUNGE ``
309315 response for each deleted message. Returned data contains a list of ``EXPUNGE ``
310316 message numbers in order received.
311317
318+ If *uid * is true, the ``UID EXPUNGE `` command (:rfc: `4315 `) is used to remove
319+ only the messages that both are marked as deleted and have a UID in
320+ *message_set *. *message_set * is required in this case, and must be omitted
321+ otherwise.
312322
313- .. method :: IMAP4.fetch(message_set, message_parts)
323+ .. versionchanged :: next
324+ Added the *message_set * and *uid * parameters.
325+
326+
327+ .. method :: IMAP4.fetch(message_set, message_parts, *, uid=False)
314328
315329 Fetch (parts of) messages. *message_parts * should be a string of message part
316330 names enclosed within parentheses, eg: ``"(UID BODY[TEXT])" ``. Returned data
317331 are tuples of message part envelope and data.
318332
333+ If *uid * is true, *message_set * is a set of UIDs and the message numbers in
334+ the response are UIDs (``UID FETCH ``).
335+
336+ .. versionchanged :: next
337+ Added the *uid * parameter.
338+
319339
320340.. method :: IMAP4.getacl(mailbox)
321341
@@ -495,12 +515,15 @@ An :class:`IMAP4` instance has the following methods:
495515 Returned data are tuples of message part envelope and data.
496516
497517
498- .. method :: IMAP4.move(message_set, new_mailbox)
518+ .. method :: IMAP4.move(message_set, new_mailbox, *, uid=False )
499519
500520 Move *message_set * messages onto end of *new_mailbox *.
501521
502522 The server must support the ``MOVE `` capability (:rfc: `6851 `).
503523
524+ If *uid * is true, *message_set * is a set of UIDs and the ``UID MOVE ``
525+ command is used instead of ``MOVE ``.
526+
504527 .. versionadded :: next
505528
506529
@@ -575,7 +598,7 @@ An :class:`IMAP4` instance has the following methods:
575598 code, instead of the usual type.
576599
577600
578- .. method :: IMAP4.search(charset, criterion[, ...])
601+ .. method :: IMAP4.search(charset, criterion[, ...], *, uid=False )
579602
580603 Search mailbox for matching messages. *charset * may be ``None ``, in which case
581604 no ``CHARSET `` will be specified in the request to the server. The IMAP
@@ -584,14 +607,14 @@ An :class:`IMAP4` instance has the following methods:
584607 the ``UTF8=ACCEPT `` capability was enabled using the :meth: `enable `
585608 command.
586609
610+ If *uid * is true, the message numbers in the response are UIDs
611+ (``UID SEARCH ``).
612+
587613 A criterion passed as :class: `str ` is encoded to *charset * (which must name
588614 a codec known to Python); pass :class: `bytes ` to send a criterion that is
589615 already encoded, for example when *charset * is one that Python does not
590616 support.
591617
592- .. versionchanged :: next
593- ``str `` search criteria are encoded to *charset *.
594-
595618 Example::
596619
597620 # M is a connected IMAP4 instance...
@@ -600,6 +623,12 @@ An :class:`IMAP4` instance has the following methods:
600623 # or:
601624 typ, msgnums = M.search(None, '(FROM "LDJ")')
602625
626+ .. versionchanged :: next
627+ Added the *uid * parameter.
628+
629+ .. versionchanged :: next
630+ ``str `` search criteria are encoded to *charset *.
631+
603632
604633.. method :: IMAP4.select(mailbox='INBOX', readonly=False)
605634
@@ -644,7 +673,7 @@ An :class:`IMAP4` instance has the following methods:
644673 Returns socket instance used to connect to server.
645674
646675
647- .. method :: IMAP4.sort(sort_criteria, charset, search_criterion[, ...])
676+ .. method :: IMAP4.sort(sort_criteria, charset, search_criterion[, ...], *, uid=False )
648677
649678 The ``sort `` command is a variant of ``search `` with sorting semantics for the
650679 results. Returned data contains a space separated list of matching message
@@ -659,11 +688,16 @@ An :class:`IMAP4` instance has the following methods:
659688 the interpretation of strings in the searching criteria. It then returns the
660689 numbers of matching messages.
661690
691+ If *uid * is true, the message numbers in the response are UIDs (``UID SORT ``).
692+
662693 As with :meth: `search `, a *search_criterion * passed as :class: `str ` is
663694 encoded to *charset *; pass :class: `bytes ` to send one already encoded.
664695
665696 This is an ``IMAP4rev1 `` extension command.
666697
698+ .. versionchanged :: next
699+ Added the *uid * parameter.
700+
667701 .. versionchanged :: next
668702 ``str `` search criteria are encoded to *charset *.
669703
@@ -695,12 +729,15 @@ An :class:`IMAP4` instance has the following methods:
695729 Request named status conditions for *mailbox *.
696730
697731
698- .. method :: IMAP4.store(message_set, command, flag_list)
732+ .. method :: IMAP4.store(message_set, command, flag_list, *, uid=False )
699733
700734 Alters flag dispositions for messages in mailbox. *command * is specified by
701735 section 6.4.6 of :rfc: `3501 ` as being one of "FLAGS", "+FLAGS", or "-FLAGS",
702736 optionally with a suffix of ".SILENT".
703737
738+ If *uid * is true, *message_set * is a set of UIDs and the ``UID STORE ``
739+ command is used instead of ``STORE ``.
740+
704741 For example, to set the delete flag on all messages::
705742
706743 typ, data = M.search(None, 'ALL')
@@ -720,12 +757,15 @@ An :class:`IMAP4` instance has the following methods:
720757 Python 3.6, handles them if they are sent from the server, since this
721758 improves real-world compatibility.
722759
760+ .. versionchanged :: next
761+ Added the *uid * parameter.
762+
723763.. method :: IMAP4.subscribe(mailbox)
724764
725765 Subscribe to new mailbox.
726766
727767
728- .. method :: IMAP4.thread(threading_algorithm, charset, search_criterion[, ...])
768+ .. method :: IMAP4.thread(threading_algorithm, charset, search_criterion[, ...], *, uid=False )
729769
730770 The ``thread `` command is a variant of ``search `` with threading semantics for
731771 the results. Returned data contains a space separated list of thread members.
@@ -743,11 +783,17 @@ An :class:`IMAP4` instance has the following methods:
743783 returns the matching messages threaded according to the specified threading
744784 algorithm.
745785
786+ If *uid * is true, the message numbers in the response are UIDs
787+ (``UID THREAD ``).
788+
746789 As with :meth: `search `, a *search_criterion * passed as :class: `str ` is
747790 encoded to *charset *; pass :class: `bytes ` to send one already encoded.
748791
749792 This is an ``IMAP4rev1 `` extension command.
750793
794+ .. versionchanged :: next
795+ Added the *uid * parameter.
796+
751797 .. versionchanged :: next
752798 ``str `` search criteria are encoded to *charset *.
753799
0 commit comments