Sync -> Mails there. Sync -> mails gone
Tomasz Żok
tomasz.zok at gmail.com
Thu Jan 29 11:13:11 GMT 2015
Hi Matthias,
the problem is that in your regular expression, you explicitly demand a dot at
the end of 'INBOX' or 'localPREFIX' part. This makes the nametrans in RemoteFoo:
- change 'INBOX.Example' into 'localPREFIX.Example'
- change 'INBOX' into 'localPREFIX.INBOX' (because no dot was at the end)
Then, the nametrans in LocalFoo will:
- change 'localPREFIX.Example' into 'INBOX.Example'
- change 'localPREFIX.INBOX' into 'INBOX.INBOX'
You have two options I think:
1. Change RemoteFoo's nametrans regexp: '^INBOX\.?'
Change LocalFoo's nametrans regexp: '^localPREFIX\.?'
2. Change LocalFoo's nametrans into:
lambda foldername = if foldername == 'localPREFIX.INBOX' then 'INBOX' else 'INBOX.' + re.sub('^localPREFIX\.', '', foldername)
In the first approach, the 'localPREFIX.INBOX' would be just 'localPREFIX' and
I am not sure how would your e-mail client react to this... So please try if it
works and if it it turns out to be the real source of problem, maybe you can
find a more elegant solution.
All the best,
Tomasz
On 2015-01-29 at 11:20, Matthias Beyer wrote:
> I found the issue, but I don't know how to solve it:
>
> My nametrans renames the folders as requested, BUT the "INBOX" folder
> gets renamed to "localPREFIX.INBOX" (which is fine) when syncing
> remote->local. But on syncing local to remote, it gets renamed
> "INBOX.INBOX", which is obviousely wrong.
>
> The problem is, that I don't know how to solve this issue properly.
> Doing an if-else in the nametrans results in syntax errors, I don't
> know how much python this thing understands, so I tried solving it
> with regex only, but ... well, I can't get it working.
>
> Maybe you guys can?
>
> On 29-01-2015 10:44:49, Matthias Beyer wrote:
> > [Repository LocalFoo]
> > ...
> > nametrans = lambda foldername = "INBOX." + re.sub('^localPREFIX\.', '', foldername)
> > folderfilter = lambda foldername = foldername.startswith('localPREFIX.')
> >
> > [Repository RemoteFoo]
> > ...
> > nametrans = lambda foldername = "localPREFIX." + re.sub('^INBOX\.', '', foldername)
More information about the OfflineIMAP-project
mailing list