aboutsummaryrefslogtreecommitdiffstats
path: root/cloud_mdir_sync/maildir.py
diff options
context:
space:
mode:
authorJason Gunthorpe <jgg@mellanox.com>2020-01-31 15:56:05 -0400
committerJason Gunthorpe <jgg@mellanox.com>2020-01-31 16:11:39 -0400
commit5a8e0e554679223319d03a242e7985602fe66bcb (patch)
tree65911c901516c381a2fee8cba4ad6d5c2f922916 /cloud_mdir_sync/maildir.py
parent2a8249a4c0ff136c8b6a819f700b95285258ef10 (diff)
downloadcloud_mdir_sync-5a8e0e554679223319d03a242e7985602fe66bcb.tar.gz
cloud_mdir_sync-5a8e0e554679223319d03a242e7985602fe66bcb.tar.bz2
cloud_mdir_sync-5a8e0e554679223319d03a242e7985602fe66bcb.zip
Support the Trash flag in MailDir
This can be set by mutt when 'set maildir_trash=yes' and shows as a deleted item. Keep track of it on the maildir side. Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'cloud_mdir_sync/maildir.py')
-rw-r--r--cloud_mdir_sync/maildir.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/cloud_mdir_sync/maildir.py b/cloud_mdir_sync/maildir.py
index fdc8a90..e1f4082 100644
--- a/cloud_mdir_sync/maildir.py
+++ b/cloud_mdir_sync/maildir.py
@@ -54,6 +54,8 @@ class MailDirMailbox(mailbox.Mailbox):
res.add("S")
if msg.flags & messages.Message.FLAG_FLAGGED:
res.add("F")
+ if msg.flags & messages.Message.FLAG_DELETED:
+ res.add("T")
return res
def _decode_msg_filename(self, fn):
@@ -71,6 +73,8 @@ class MailDirMailbox(mailbox.Mailbox):
mflags |= messages.Message.FLAG_READ
if "F" in flags:
mflags |= messages.Message.FLAG_FLAGGED
+ if "T" in flags:
+ mflags |= messages.Message.FLAG_DELETED
assert ":2," not in fn
return (fn, flags, mflags)
@@ -153,7 +157,7 @@ class MailDirMailbox(mailbox.Mailbox):
cloud_flags = self._msg_to_flags(cloudmsg)
base, mflags, _ = self._decode_msg_filename(mymsg.fn)
- nflags = (mflags - set(("R", "S", "F"))) | cloud_flags
+ nflags = (mflags - set(("R", "S", "F", "T"))) | cloud_flags
if mflags == nflags:
return
if nflags: