<DKIM> maxage causes loss of local email

Nicolas Sebrecht nicolas.s-dev at laposte.net
Thu Mar 12 00:36:45 UTC 2015


On Wed, Mar 11, 2015 at 10:15:48AM -0400, Janna Martl wrote:
> On Wed, Mar 11, 2015 at 12:01:07PM +0100, Nicolas Sebrecht wrote:
> >On Wed, Mar 11, 2015 at 03:23:09AM -0400, Janna Martl wrote:
> >> On Wed, Mar 11, 2015 at 01:50:13AM -0400, Janna Martl wrote:
> >> >
> >> >                X  Y      W
> >> >|--------------|---------------|
> >> >-24             0             24
> >> >
> >> >                   Y  Z   W
> >> >        |--------------|---------------|
> >> >       -24             0             24
> >> >
>
> >Don't forget the case where there is no Y. This is true at the first run
> >and if user didn't have mail for a long time enough (> maxage).
> 
> If there's no Y, then messagelist1 = [X,W], messagelist2 = [W], and
> nothing changes when you try to exclude things based on the maxage + 1
> lists. So X gets deleted, which is correct. If there's no mail in this
> range, then the lists are empty, nothing gets excluded, and nothing
> happens.

Let's check.

CASE ONE (local time is oldest)
--------

(server)
                    B      D  E       X
                    |--------------|---------------|
                   -24             0             24

(local)
                 A     C   D     F    X
          |--------------|---------------|
          -24             0             24

We want to sync [X].
Syncing [D, E, F, X] is still acceptable.



CASE TWO (server time is oldest)
--------

(server)
                    B  C      E  F    X
 |--------------|---------------|
-24             0             24

(local)
                 A     C   D     F    X
          |--------------|---------------|
          -24             0             24

We want to sync [D, E, F, X].

So in both case, we should stop at UIDs > C.

Now comes the processing logic.

local_messageslist  # ONE SCAN  for messages in range [(maxage + 1)..lastest]
server_messageslist # ONE FETCH for messages in range [(maxage + delta + 1)..lastest]

local_lowest_uid = None
# Assumed UID ordered, lowest to biggest.
for m in local_messageslist:
    if (maxage) < m[uid]['rtime']
        continue
    # Processing uids for messages > (maxage)
    if uid in server_messageslist:
        local_lowest_uid = local_messageslist[uid]
        break

# Clean the lists for messages we should not sync.
if local_lowest_uid != None:
    for mlist in [local_messageslist, server_messageslist]:
        for uid in mlist:
            if uid > local_lowest_uid:
                continue
            del mlist[uid]

CASE THREE
----------

Same as cases one and two but without C.
We will sync [A, B, D, E, F, X] which is still acceptable.


What do you think?

-- 
Nicolas Sebrecht



More information about the OfflineIMAP-project mailing list