Working 6.3.4 config breaks in 6.5.2.1

Daniel Shahaf d.s at daniel.shahaf.name
Mon Feb 13 16:59:57 UTC 2012


Michael Williams wrote on Mon, Feb 13, 2012 at 17:40:38 +0100:
> Hi all,
> 
> thanks to all who quickly spotted the problem, and for the configuration changes.
> 
> On 13 Feb 2012, at 17:00, Daniel Shahaf wrote:
> Sebastian Spaeth wrote on Mon, Feb 13, 2012 at 14:47:59 +0100:
> >> On Fri, 10 Feb 2012 14:11:41 +0100, Michael Williams wrote:
> >>> [Repository remotempe]
> >>> nametrans = lambda foldername: re.sub('^INBOX.', '', foldername)
> >> 
> >> So your remote repository cuts off the initial INBOX., you'll need to
> >> append them from your local repository so that offlineimap is able to
> >> find the corresponding mapping (nametrans is one-way only...)
> >> 
> >> I'd suggest something like:
> >> 
> >> [Repository localmpe]
> >> type = Maildir
> >> localfolders = ~/.mail/mpe
> >> nametrans = lambda folder: "INBOX." + folder
> >> 
> >> Would that work for you?
> > 
> > It'll break when the remote folder name is "INBOX".
> > 
> > nametrans = lambda f: ["INBOX."+f, f][f == "INBOX"]
> 
> I can figure out roughly what Sebastian's (and Jonas Hörsch's)
> suggestion does, but I don't speak Python, so I don't understand how
> Daniel's works.

It constructs a list (array) of two elements and then picks an element
of that array:

  l = ["INBOX."+f, f]
  if f == "INBOX":
    return l[1]
  else:
    return l[0]

Another option is:

nametrans = lambda f: "INBOX."+f if f != "INBOX" else f

And in any case, both of these assume that all your folders, except
"INBOX", are named "INBOX.something".


> But in any case I tried both of these. I synced using
> 6.3.4 then inserted each line into my offlineimaprc and then ran
> 6.5.2.1. In both cases, offlineimap copied new messages (i.e. negative
> message index) from the local repository to the remote. This didn't
> seem right, given I had just synced, so I aborted the process.
> 
> Since I am, in principle, risking data loss here, I would be very
> grateful for some clarification and reassurance! Which one of these
> snippets is right? Should my first 6.5.2.1 session result in data
> transfer?
> 
> Mike



More information about the OfflineIMAP-project mailing list