summaryrefslogtreecommitdiff
path: root/src/leap/mail/imap/messageparts.py
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2014-01-23 13:32:01 -0400
committerKali Kaneko <kali@leap.se>2014-01-28 19:38:45 -0400
commitff28e22977db802c87f0b7be99e37c6de29183e9 (patch)
treec75bc293bc171cbc65dd494a8947057f306b8c96 /src/leap/mail/imap/messageparts.py
parent0754dac293730b02942716991d5edc513c36ff7c (diff)
Unset new flag after successful write
Diffstat (limited to 'src/leap/mail/imap/messageparts.py')
-rw-r--r--src/leap/mail/imap/messageparts.py33
1 files changed, 27 insertions, 6 deletions
diff --git a/src/leap/mail/imap/messageparts.py b/src/leap/mail/imap/messageparts.py
index 3f89193..42eef02 100644
--- a/src/leap/mail/imap/messageparts.py
+++ b/src/leap/mail/imap/messageparts.py
@@ -125,20 +125,41 @@ class MessageWrapper(object):
# properties
- @property
- def new(self):
+ def _get_new(self):
+ """
+ Get the value for the `new` flag.
+ """
return self._new
- def set_new(self, value=True):
+ def _set_new(self, value=True):
+ """
+ Set the value for the `new` flag, and propagate it
+ to the memory store if any.
+ """
self._new = value
+ if self.memstore:
+ mbox = self.fdoc.content['mbox']
+ uid = self.fdoc.content['uid']
+ key = mbox, uid
+ fun = [self.memstore.unset_new,
+ self.memstore.set_new][int(value)]
+ fun(key)
+ else:
+ logger.warning("Could not find a memstore referenced from this "
+ "MessageWrapper. The value for new will not be "
+ "propagated")
- @property
- def dirty(self):
+ new = property(_get_new, _set_new,
+ doc="The `new` flag for this MessageWrapper")
+
+ def _get_dirty(self):
return self._dirty
- def set_dirty(self, value=True):
+ def _set_dirty(self, value=True):
self._dirty = value
+ dirty = property(_get_dirty, _set_dirty)
+
# IMessageContainer
@property