[PATCH v2 2/2] folder/IMAP: savemessage() should just save flags if uid already exists

Sebastian Spaeth Sebastian at SSpaeth.de
Wed Mar 16 15:03:35 GMT 2011

As the LocalStatus and UIDMap backend already did: If the uid already
exists for savemessage(), only modify the flags and don't append a new

We don't invoke savemessage() on messages that already exist in our sync
logic, so this has no change on our current behavior. But it makes
backends befave more consistent with each other.

Signed-off-by: Sebastian Spaeth <Sebastian at SSpaeth.de>
 offlineimap/folder/IMAP.py |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/offlineimap/folder/IMAP.py b/offlineimap/folder/IMAP.py
index 89848b2..74a9b87 100644
--- a/offlineimap/folder/IMAP.py
+++ b/offlineimap/folder/IMAP.py
@@ -394,6 +394,11 @@ class IMAPFolder(BaseFolder):
                   server. If the folder is read-only it will return 0."""
         self.ui.debug('imap', 'savemessage: called')
+        # already have it, just save modified flags
+        if uid > 0 and uid in self.messagelist:
+            self.savemessageflags(uid, flags)
+            return uid
             imapobj = self.imapserver.acquireconnection()

More information about the OfflineIMAP-project mailing list