]> khamidou — GitHub mirrors - imapclient.git/commitdiff
initial stab at a copy command, not tested
authorMenno Smits <menno@freshfoo.com>
Fri, 22 Jan 2010 13:10:46 +0000 (13:10 +0000)
committerMenno Smits <menno@freshfoo.com>
Fri, 22 Jan 2010 13:10:46 +0000 (13:10 +0000)
imapclient/imapclient.py

index c77dce1f991ece420705bcf7df96817e026579ca..c78a28b17eb5ebdcb8fcb2c7345d0e84e77ce2fe 100644 (file)
@@ -465,6 +465,20 @@ class IMAPClient(object):
         return data[0]
 
 
+    def copy(self, messages, folder):
+        """XXX
+        """
+        msg_list = messages_to_str(messages)
+        folder = self._encode_folder_name(folder)
+
+        if self.use_uid:
+            typ, data = self._imap.uid('COPY', msg_list, folder)
+        else:
+            typ, data = self._imap.copy(msg_list, folder)
+        self._checkok('copy', typ, data)
+        return data[0]
+
+
     def expunge(self):
         typ, data = self._imap.expunge()
         self._checkok('expunge', typ, data)