maxage: fix timezone issues, remove IMAP-IMAP support, add startdate option

1. When using maxage, local and remote messagelists are supposed to only
contain messages from at most maxage days ago. But local and remote used
different timezones to calculate what "maxage days ago" means, resulting
in removals on one side. Now, we ask the local folder for maxage days'
worth of mail, find the lowest UID, and then ask the remote folder for
all UID's starting with that lowest one.

2. maxage was fundamentally wrong in the IMAP-IMAP case: it assumed that
remote messages have UIDs in the same order as their local counterparts,
which could be false, e.g. when messages are copied in quick succession.
So, remove support for maxage in the IMAP-IMAP case.

3. Add startdate option for IMAP-IMAP syncs: use messages from the given
repository starting at startdate, and all messages from the other
repository. In the first sync, the other repository must be empty.

4. Allow maxage to be specified either as number of days to sync (as
previously) or as a fixed date.

Signed-off-by: Janna Martl <janna.martl109@gmail.com>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Janna Martl
2015-04-07 01:14:11 -07:00
committed by Nicolas Sebrecht
parent 71693b7d8c
commit 8096f6cd5b
9 changed files with 361 additions and 128 deletions

View File

@ -260,6 +260,8 @@ remoterepository = RemoteExample
# This option stands in the [Account Test] section.
#
# OfflineImap can replace a number of full updates by quick synchronizations.
# This option is ignored if maxage or startdate are used.
#
# It only synchronizes a folder if
#
# 1) a Maildir folder has changed
@ -327,21 +329,26 @@ remoterepository = RemoteExample
# This option stands in the [Account Test] section.
#
# When you are starting to sync an already existing account you can tell
# OfflineIMAP to sync messages from only the last x days. When you do this,
# messages older than x days will be completely ignored. This can be useful for
# importing existing accounts when you do not want to download large amounts of
# archive email.
# maxage enables you to sync only recent messages. There are two ways to specify
# what "recent" means: if maxage is given as an integer, then only messages from
# the last maxage days will be synced. If maxage is given as a date, then only
# messages later than that date will be synced.
#
# Messages older than maxage days will not be synced, their flags will not be
# changed, they will not be deleted, etc. For OfflineIMAP it will be like these
# messages do not exist. This will perform an IMAP search in the case of IMAP
# or Gmail and therefore requires that the server support server side searching.
# This will calculate the earliest day that would be included in the search and
# include all messages from that day until today. The maxage option expects an
# integer (for the number of days).
# Messages older than the cutoff will not be synced, their flags will not be
# changed, they will not be deleted, etc. For OfflineIMAP it will be like these
# messages do not exist. This will perform an IMAP search in the case of IMAP or
# Gmail and therefore requires that the server support server side searching.
#
# Known edge cases are described in offlineimap(1).
#
# maxage is allowed only when the local folder is of type Maildir. It can't be
# used with startdate.
#
# The maxage option expects an integer (for the number of days) or a date of the
# form yyyy-mm-dd.
#
#maxage = 3
#maxage = 2015-04-01
# This option stands in the [Account Test] section.
@ -446,6 +453,21 @@ localfolders = ~/Test
#sep = "."
# This option stands in the [Repository LocalExample] section.
#
# startdate syncs mails starting from a given date. It applies the date
# restriction to LocalExample only. The remote repository MUST be empty
# at the first sync where this option is used.
#
# Unlike maxage, this is supported for IMAP-IMAP sync.
#
# startdate can't be used with maxage.
#
# The startdate option expects a date in the format yyyy-mm-dd.
#
#startdate = 2015-04-01
# This option stands in the [Repository LocalExample] section.
#
# Some users may not want the atime (last access time) of folders to be