Sync INTERNALDATE <-> mtime

The attached patch adds syncing the INTERNALDATE of IMAP folders with
the mtime of messages in maildir folders.
I want this to happen, because I'm running a dovecot over the maildirs
synced by offlineimap, and that uses the mtime as the INTERNALDATE.
When using mutt to view messages I generally sort based on the received
date, which for IMAP folders is the INTERNALDATE.

Since this is the first real coding I've done in Python the patch may
need to be cleaned up some, but it's working pretty well for me.  I've
added new messages to each side, and the received date has been
preserved going both ways.
This commit is contained in:
John Goerzen
2006-08-22 02:09:36 +01:00
parent e4db4200a2
commit 03488ba81b
6 changed files with 56 additions and 23 deletions

View File

@ -98,7 +98,7 @@ class LocalStatusFolder(BaseFolder):
def getmessagelist(self):
return self.messagelist
def savemessage(self, uid, content, flags):
def savemessage(self, uid, content, flags, rtime):
if uid < 0:
# We cannot assign a uid.
return uid
@ -107,13 +107,16 @@ class LocalStatusFolder(BaseFolder):
self.savemessageflags(uid, flags)
return uid
self.messagelist[uid] = {'uid': uid, 'flags': flags}
self.messagelist[uid] = {'uid': uid, 'flags': flags, 'time': rtime}
self.autosave()
return uid
def getmessageflags(self, uid):
return self.messagelist[uid]['flags']
def getmessagetime(self, uid):
return self.messagelist[uid]['time']
def savemessageflags(self, uid, flags):
self.messagelist[uid]['flags'] = flags
self.autosave()