[PATCH v4] Re: make maxage use UIDs to avoid timezone issues
Abdó Roig-Maranges
abdo.roig at gmail.com
Mon Apr 6 20:00:51 BST 2015
Nicolas Sebrecht writes:
> On Mon, Apr 06, 2015 at 04:40:43PM +0200, Abdó Roig-Maranges wrote:
>
>> 2. Now, I think that we could give 'mtime' a global meaning. On Maildir could
>> mean unix modification time, and on IMAP mean the internal date. Then have a
>> unified 'time' field in all cache messages, statusfolder, etc.
>
> How would this differ from rtime? For what purpose?
hmm... currently the times thing is a bit of a mess. I'm partially to blame for
this because I introduced the mtimes for quick sync without having a full
picture... anyway, currently we have the following timestamps attached to
messages:
* mtime.
- It means: last time this local message changed on disk.
- We cache it in GmailMaildir.
- Stored and cached in the statusfolder as 'mtime'. However, it only makes
sense when syncing a GmailMaildir.
- It is internal to GmailMaildir. However we have getmessagemtime and use it
from the outside of the class because we need access to the status
folder... This is "a leak of implementation details" as it is now, but was
the easiest way to do it.
* IMAP internal date.
- It means: "time at which the server received the message" (can you
confirm?).
- It is not cached in IMAPFolder.
- It is cached in the statusfolder as time, but not stored! It is passed as
rtime when the IMAP folder is on the remote side.
- It is going to be used for the maxage thing.
* rtime.
- It means: internal date on the remote IMAP.
- It is passed to savemessage, and is to be used to create local Maildir
filenames.
- The rtime is cached in the statusfolder too, as 'time', but not stored! I
think it is useless.
* date header.
- It means: date at which the message was written.
- It is used by utime_from_header to affect local modification times. It is
decoupled now from rtime, and kept within MaildirFolder.
> I'm not sure about merging rtime and mtime. They have different purposes
> for sure. mtime might be compatible with how rtime is computed or not, I
> don't know.
Well, the mtime and IMAP internal time are properties of a message that have
quite similar meaning. Since one applies to IMAP and the other to Maildir, I
think merging them is ok, and simplifies things a little bit, making IMAPFolder
and MaildirFolder more homogeneous.
The rtime, of course is different. In the context it is used, means whatever
timestamp is attached to the message on the remote.
What I propose is something like this:
1. All folders will implement getmessagetime. Maildirs returns unix mtime, and
IMAP return internal time.
2. That time, is cached in messagelist as 'time', on all IMAP and Maildir folders.
3. We store, and cache ONLY the local time in statusfolder.
4. We get rid of getmessagemtime, and use getmessagetime instead.
The main point of this making objects more uniform so we can reuse more
code. After those changes, we could probably move some shared code to
BaseFolder.
Abdó.
More information about the OfflineIMAP-project
mailing list