]> khamidou — GitHub mirrors - imapclient.git/commitdiff
Add support for the MOVE command. add_move_support
authorKarim Hamidou <khamidou@gmail.com>
Tue, 1 Nov 2016 19:11:29 +0000 (12:11 -0700)
committerKarim Hamidou <khamidou@gmail.com>
Tue, 1 Nov 2016 19:11:29 +0000 (12:11 -0700)
See RFC 6851 (https://tools.ietf.org/html/rfc6851) for more details.

imapclient/imapclient.py

index 969b6057c683f1e34ec51141db4910ea4835eae0..aad37ec7584902697e722ebc3feceb47087bfe99 100644 (file)
@@ -1029,6 +1029,18 @@ class IMAPClient(object):
                                        self._normalise_folder(folder),
                                        uid=True, unpack=True)
 
+
+    def move(self, messages, folder):
+        """Move one or more messages from the current folder to
+        *folder*. Returns the MOVE response string returned by the
+        server.
+        """
+        return self._command_and_check('move',
+                                       join_message_ids(messages),
+                                       self._normalise_folder(folder),
+                                       uid=True, unpack=True)
+
+
     def expunge(self):
         """Remove any messages from the currently selected folder that
         have the ``\\Deleted`` flag set.